taks kamps

taks kamps

  • NA
  • 39
  • 6.1k

nested if's statements

Dec 14 2018 9:00 PM

a nested if statement after the assignment of string1 to result,
such that if i is greater than 5 and j is less than 5 append string2 to the result... some code i have done so far
 
using System;

namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
int i = 10; int j = 5;

const string string1 = "Foo";
const string string2 = "Bar";
string result = "";


if(i > j)
{
result = string1;
if ((i>5) & (j<5))
{
result = string2;
}
}

Console.WriteLine(result);
}
}
}

Answers (1)