Computer Science, asked by kunjuathu2002, 4 months ago

write a program to count the number of students having age less than 25 and weight less than 50 kg out of 5 using while loop in c ​


allysia: please write the language (in which you need the program) in such questions.

Answers

Answered by narmeensayed296gmail
2

Answer:

#include <stdio.h>

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;

Similar questions