Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18 , adds 1 to the variable adults if age is 18 through 64 , and adds 1 to the variable seniors if age is 65 or older.
LANGUAGE: C++
CHALLENGE:
Write an if/else statement that adds 1 to the variable minors if the variable age is less than 18 , adds 1 to the variable adults if age is 18 through 64 , and adds 1 to the variable seniors if age is 65 or older.
SOLUTION:
if(age < 18){ minors = minors + 1; }else if(age > 17 && age < 65){ adults = adults + 1; }else{ seniors = seniors + 1; }
Posted in C++, Learn To Code