i am new in C# and understanding how the if statement works i wrote these code but there seems to be a problem with it.When i write something that is 50 or greater and less then 60 it says Passed but the else if statement is not working.Whenever i write something greater then 60 nothing happens my program closes.
Console.WriteLine("Please state your marks........");
string uservalue = Console.ReadLine();
int x = Convert.ToInt32(uservalue);
if (x >=50)
{
if ( x <= 59)
{
Console.WriteLine("You Passed");
}
}
else if (x >=60)
{
Console.WriteLine("Passed Grade B");
}
Console.ReadLine();
Aucun commentaire:
Enregistrer un commentaire