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); } } } } }

20th Jan 2019, 11:13 PM
Federico Di Mauro
Federico Di Mauro - avatar
4 ответов
+ 3
You could send it through a code here. It would be neater
20th Jan 2019, 11:16 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 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?
20th Jan 2019, 11:17 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
You could send it through a code here. It would be neater
20th Jan 2019, 11:15 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
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"
21st Jan 2019, 2:05 PM
Federico Di Mauro
Federico Di Mauro - avatar