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

4/100 write as a percent
How did the other passengers react to Rosa parks' actions?
Anja buys a magazine and a pizza. She spends $9.75. The pizza costs twice as much as the magazine. How much does the pizza cost?
1/9 =something to the 2nd power
Which gas makes up most of Earth's atmosphere? A. argon B. oxygen C. nitrogen D. carbon dioxide
Kelly shows all the ways to make 49 as tens and ones. What ways does she show
A population of short-finned fish and a population of long-finned fish live in a lake. Fish with long fins swim faster than fish with short fins, which means th
why is it important to know how to interpret a remainder
show all the ways to make 34 as tens and ones
A victim of sexual assault should do all of the following except a. take a bath or shower. b. make sure he or she is safe from further harm. c. ask someone t