Its good for beginning , but you could help the one who use it with asking him the question how old is he Like this way:Quote:
I have to agree with an earlier post about lesson four Type Conversion I got kind of confused at the end but that`s because my math sucks lol. I get the concept of it all though within reason :) I shall continue reading and yes I am actually learning :D
Ok so I did it this way is it wrong (obviously not that much because it worked)
Oh and THANK YOU! I definately recommend this to anybody that wants to learn and understand C# because you have explained it very simply and this is the kind of thing I can learn from :D It`s similar to how I have learnt php/html/javascriptCode:namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int age = int.Parse(Console.ReadLine()); if (age < 16) { Console.WriteLine("You can`t enter"); } else if ((age >= 16) && (age <= 18)) { Console.WriteLine("You can come in but can`t drink"); } else if (age >= 19) { Console.WriteLine("You can drink as well"); } } } }
Code:
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
[B][I]Console.Write("How Old Are You ? Answer : ");[/I][/B]
int age = int.Parse(Console.ReadLine());
if (age < 16)
{
Console.WriteLine("You can`t enter");
}
else if ((age >= 16) && (age <= 18))
{
Console.WriteLine("You can come in but can`t drink");
}
else if (age >= 19)
{
Console.WriteLine("You can drink as well");
}
}
}
}