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

how do you turn 1/10 into a decimal
factor 6x^2+11x+4 ...?
A recipe uses 2 cups of sugar to make 32 brownies. How many cups of sugar are needed to make 72 brownies?
The R groups of amino acids located on the surface of protein molecules in the interior of biological membranes are ...?
Which of the following elements is a metal? carbon (C) iodine (I) iridium (Ir) radon (Rn)
She got soaked walking home in the rain yesterday because her umbrella was in her gym locker. Which part of this sentence is a clause? "she got soaked walking"
Which is the correct description of the transformation of figure QRST to figure QꞌRꞌSꞌTꞌ? A. a 90° counterclockwise rotation around point R of pre-image QRST B.
Which answer best expresses how the Articles of Confederation established the states' roles in the court system? -The states had their own courts, but the na
list 3 things you can do to help prevent cauti
What did Locke think would happen without government