Wednesday

Write a program using C language to read the age of 100 persons and count the number of persons in the age group between 50 and 60. Use FOR and CONTINUE statement.

#include<stdio.h>
#include<conio.h>
void main()
  {
    int i,c=0;
    float a[100];
    clrscr();
    printf("\nEnter age of 100 persons");
    for(i=0;i<100;i++)
     scanf("%f",&a[i]);
    for(i=0;i<100;i++)
    {
      if (a[i]>50 && a[i]<60)
            c=c+1;
      else
      continue;
    }
    printf("Total number of persons aged between 50 and 60 are %d",c);

     getch();
 }

No comments:

Post a Comment

Rahul-Notes