+ 1
Help! Why doesn't it work?
Why doesn't it work? https://code.sololearn.com/ccwOG2TyE73d/?ref=app
4 Answers
+ 1
Age should be int instead of string. You need to parse your readline as an int. In the last 'else' you need to either make it an 'else if' or remove the condition. If I remember right, that were your errors.
https://code.sololearn.com/cmeqk0H2i5cd/#cs
int age;
Console.WriteLine("How old are you?");
age = Convert.ToInt32(Console.ReadLine());
if (age<=10)
{
Console.WriteLine("You are child");
}
else if (age<=16)
{
Console.WriteLine("You are teenager");
}
else if (age<=20)
{
Console.WriteLine("You are adult");
}
else
{
Console.WriteLine("YOU ARE OLD");
}
+ 1
Thanks)
+ 1
You're welcome.
+ 1
I have a question
Why 'int' and not 'string'?