0
What I wrong?
I would like to put my age with the console.readline and then in base of the age if I'm Adult, teen ecc, int age = 17; if (age > 14) { if(age > 18) { age = Console.ReadLine(); Console.WriteLine("Adult {0}", age); } else { Console.WriteLine("Teenager {0}", age); } } else { if (age > 0) { Console.WriteLine("Child {0}", age); } else { Console.WriteLine("Something's wrong {0}", age); } } } } }
4 Answers
+ 3
You could send it through a code here. It would be neater
+ 3
By the way if you want age as an input what is that age = 17; at the front doing and why are you using Console.ReadLine() when you know that guy is an adult?
+ 2
You could send it through a code here. It would be neater
0
this is the original code , I would like to insert my age, and then the code says me if I'm adult,teen ecc
int age = 17;
if (age > 14) {
if(age > 18) {
Console.WriteLine("Adult");
}
else {
Console.WriteLine("Teenager");
}
}
else {
if (age > 0) {
Console.WriteLine("Child");
}
else {
Console.WriteLine("Something's wrong");
}
}
//Outputs "Teenager"