Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

PROGRAM TO READ AGE OF N PERSONS AND DISPLAY ONLY THOSE PERSONS WHOSE BETWEEN 50 AND 60

Posted By: Lewis Evans     Category: C Programming     Views: 12674

WRITE A PROGRAM TO READ AGE OF N PERSONS AND DISPLAY ONLY THOSE PERSONS WHOSE BETWEEN 50 AND 60.

Code for PROGRAM TO READ AGE OF N PERSONS AND DISPLAY ONLY THOSE PERSONS WHOSE BETWEEN 50 AND 60 in C Programming

#include<stdio.h>
#include<conio.h>

void main()
{
    int i,n,age[100],count=0;

    clrscr();

    printf("Enter the number of persons  ::  ");
    scanf("%d",&n);

    for (i=1;i<=n;i++)
    {
        printf("\nEnter age of %d persons :: ",i);
        scanf("%d",&age[i]);
    }

    for (i=1;i<=n;i++)
    {
        if(age[i]>50 && age[i] < 60)
        count++;
        elsecontinue;
    }

    printf("\n\nNumber of persons whose age between 50-60 are :: %d",count);
    getch();
}


/*
**********
OUTPUT
**********

Enter the number of persons :: 6

Enter age of 1 persons :: 10

Enter age of 2 persons :: 20

Enter age of 3 persons :: 30

Enter age of 4 persons :: 55

Enter age of 5 persons :: 51

Enter age of 6 persons :: 56


Number of persons whose age between 50-60 are :: 3

*/
  
Share: 



Lewis Evans
Lewis Evans author of PROGRAM TO READ AGE OF N PERSONS AND DISPLAY ONLY THOSE PERSONS WHOSE BETWEEN 50 AND 60 is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!