//WAP to count total number of students having age in range 20 and 40 out of ‘n’ number of students
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,count=0;
in age[1000];
printf("enter total students' number-below 1000\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter age\n");
scanf("%d",&age[i]);
if(age[i]>=20 && age[i]<=40)
{
count++;
}
}
printf("total students=%d\n",count);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,count=0;
in age[1000];
printf("enter total students' number-below 1000\n");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter age\n");
scanf("%d",&age[i]);
if(age[i]>=20 && age[i]<=40)
{
count++;
}
}
printf("total students=%d\n",count);
getch();
}
No comments:
Post a Comment