42.1k views
21 votes
Write a multi-way if 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

1 Answer

7 votes

Note, this is psudocode, because i dont know what language you are coding in.

define a variable: minors

define a variable: adults

define a variable: seniors

define a variable: age

if age <18{

add one to minors

}

else if 18<age<64{

add one to adults

}

else if age >= 65{

add one to seniors

}

User Mike Tracker
by
6.0k points