Search........

Google

Friday, March 7, 2008

Conditional Statements

/ *Now we are going to see the conditional statements in this we canspecify a particular condition for executing one or more statements

Syntax:-

if(condition)

{

body

}

else if(condition)

{

body

}

else{

body

}
*/
using System;

namespace condition{

class class1

{

static void Main()

{

int inum1;

Console.WriteLine("enter a no between 1 to 100");

inum1=Convert.ToInt32(Console.ReadLine());

if (inum1<=10)

{

Console.WriteLine("the number you have entered is less than 10");

}

else if (inum1>10&&inum1<50)

{

Console.WriteLine("the number you have entered is less than 50 but more than 10");

}

else

{

Console.WriteLine("the number you have entered is more than 10");

}

}

}

}

No comments: