I'm with a problem with if codes in visual c# 2008
in this code:
Console.WriteLine("Years old? \n");
var1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\n");
if (var1 < 17)
{
Console.WriteLine("Under Old");
Console.ReadLine();
}
else if (var1 > 65)
{
Console.WriteLine("Up Up Up !");
Console.ReadLine();
I
want that if the number is less than 17 it shows a answer, if he shows
more than 65 different answer, and it is between 18 and 64 show another
answer him, is how?
Thx
and sorry for my NoobNess with this >.<
PS. This code not complete, only this part I have the problem
Thx
and sorry for my NoobNess with this >.<
PS. This code not complete, only this part I have the problem
StefanPosted Apr 27, 2009, 4:50 PM
Here's an example:
Console.Write("Years old?");
int result = Convert.ToInt32(Console.ReadLine());
if (result < 17)
{
// code to show answer
}
if (result > 18 && result < 64)
{
// code to show answer
}
if (result > 65)
{
// code to show answer
}
Hope this helps!
NicolasPosted Apr 27, 2009, 5:26 PM
works perfect.. I'm begginer on C# codes xD
thx to help !
hugs :)