fatiguee fatiguee
  • 22-09-2021
  • Computers and Technology
contestada

C program to input the ages of five students and display their ages in reverse order.

Respuesta :

bentonparrish1220
bentonparrish1220 bentonparrish1220
  • 22-09-2021
#include
int main()
{
int age;
int cnt_baby=0,cnt_school=0,cnt_adult=0;
int count=0;

while(count<15)
{
printf("Enter age of person [%d]: ",count+1);
scanf("%d",&age);

if(age>=0 && age<=5)
cnt_baby++;
else if(age>=6 && age<=17)
cnt_school++;
else
cnt_adult++;

//increase counter
count++;
}

printf("Baby age: %d\n",cnt_baby);
printf("School age: %d\n",cnt_school);
printf("Adult age: %d\n",cnt_adult);

return 0;
}
Answer Link

Otras preguntas

Please help and thank you
HELP PLEASE!!!!!!!!!!!!!!!!!!!!!!!!!!
What is the basic form of matter which cannot be broken down any further
describe what happens to a carbon-11 atom when it undergoes positron emission.
Which expression is equivalent to 2a + 5 (b + 7a) ? Select Yes or No. A. 2a + 5b + 35a Yes or No B. 2a +12b Yes or No C. 5 (b) + 5 (7a) + 2a Yes or No D.
Which convection cell in the atmosphere connects the polar jet stream and the subtropical jet stream
How can you establish common ground in your research essay
What differentiates physical design from logical design?A.) Logical design refers to entities and relationships, while physical design refers to input and outpu
What’s 6 I don’t get it need answers fast and 7 can anyone help?!
simplify the expression? -3 -559/5