You are on page 1of 2

#include<iostream>

using namespace std;

main()
{
unsigned int age[1000];
int typa, typb, typc;
typa=0;
typb=0;
typc=0;
cout<<"\n\t\t Program to group different persons according to their age";
cout<<"\n These are the age groups: ";
cout<<"\n 1 : 25-35";
cout<<"\n 2 : 36-45";
cout<<"\n 3 : 46-55";
cout<<"\n Enter the ages of different people....";
for(int i=0; i<1000; i++)
{
cout<<"\n Enter age: ";
cin>>age[i];
if((age[i]>=25) && (age[i]<=35))
typa++;
else if((age[i]>=36) && (age[i]<=45))
typb++;
else if((age[i]>=46) && (age[i]<=55))

typc++;
if(age[i]>55)
cout<<"\n Sorry this is in an invalid age group, this will not be
counted !!!";

}
cout<<"\n No. of people in the age group (1 : 25-35) are : "<<typa;
cout<<"\n No. of people in the age group (2 : 36-45) are : "<<typb;
cout<<"\n No. of people in the age group (3 : 46-55) are : "<<typc;

You might also like