Thursday, 5 February 2015

C++ Program to read 10 number and count how many of them are even or odd 


#include<iostream.h>
#include<conio.h>
void main()
{
 int i,a,even=0;
 clrscr();
 cout<<"Enter 10 no. and check even and odd:\n";
  for(i=1;i<=10;i++)
  {
   cin>>a;
   if(a%2==0)
    even=even+1;
  }
  cout<<"There are"<<even<<" even number";
  cout<<"\nThere are"<<10-even<<" odd number";
  getch();
}

No comments:

Post a Comment