Friday, April 10, 2015

6. Write a program using C language to read the age of 100 persons and count the number of persons the age group between 50 and 60.Use "for" and "continue" statements.


#include<stdio.h>
#include<conio.h>
void main()
{
int age[100],i,n,count=0;
clrscr();
printf("\n Input age of 100 persons:-");
for(i=0;i<100;i++)
scanf("%d",&age[i]);
for(i=0;i<100;i++)
{
if(age[i]>=50&&age[i]<=60)
count++;
else
continue;
}
printf("There are %d persons whose age is in between 50 and 60 years",count);
getch();
}

7 comments: