0
Why is there no output for the second or third ifs?
when I change age to other numbers that should change the output, it just says no output static void Main(string[] args) { int age =16; if(age > 16){ if(age < 18){ Console.WriteLine("adult."); } else { if(age<16){ if(age>12){ Console.WriteLine("teen"); } } } } else { if(age<12){ Console.WriteLine("kid"); } } } } }
2 Réponses
0
no. those are for the beginning of the code
0
1) Its good practice set the language name like tag of your question
2) Its MORE good practice save your code on SL code playground and post in Q&A a link to it and not copy/paste your code
3) Seem to me that with age=16 no code its runned
4) You know that can use logical AND and OR if your condition for check multiple conditions? Example:
if(age>16 && age<18){
/* this code will run only if age its 17 */
.......
}