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

The pick-and-roll is an example of both a team and an individual sport strategy. TRUE OR FALSE
what is 15% of 68.97
What happened to midwest farmers in the late 19th century?
How many h and min from 11.52am to 2.27pm
Addison made 11 quarts of punch for her party. How many gallons of punch did she make? THANK YOU ;)
What is resolving power? What effects it?
who's theory of evolution unifies all of biology?
How many moles of sulphur dioxide are produced when 72.0 grams of water is produced by the process: 2H2S + 3O2 --> 2H2O + 2SO2
which expression is equivalent to 8c + 6 - 3c - 2
The first legislative assembly in the English colonies was the a. House of Commons. b. House of Burgesses. c. House of Lords. d. House of Delegates