Program to Read The Age of n Persons & Count The Number of Persons Who Are Not in The Age Group 50-60 [C Programming]
#include<stdio.h>
int main()
{
int i, n, age, count=0;
printf("How many person's age do you want to insert?\n");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
printf("Enter age of person %d: ", i);
scanf("%d", &age);
if(age < 50 || age > 60)
{
count++;
}
}
printf("\nNumber of person(s) who are not in age group 50 - 60 is: %d", count);
return 0;
}
int main()
{
int i, n, age, count=0;
printf("How many person's age do you want to insert?\n");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
printf("Enter age of person %d: ", i);
scanf("%d", &age);
if(age < 50 || age > 60)
{
count++;
}
}
printf("\nNumber of person(s) who are not in age group 50 - 60 is: %d", count);
return 0;
}
Comments
Post a Comment