Sunday, 7 December 2014

#include<iostream.h>
#include<conio.h>
void main()
{
 int n,k=0,l=0;
 clrscr();
 cout<<"\nenter n:";
 cin>>n;
 cout<<"\neven nums are:";
 for(int i=0;i<=n;i++)
  if(i%2==0)
  {
   cout<<"\t"<<i;
   k++;
  }
  cout<<"\nnum of evens:"<<k;
 cout<<"\nodd nums are:";
 for(i=0;i<=n;i++)
  if(i%2!=0)
  {
   cout<<"\t"<<i;
   l++;
  }
  cout<<"\n no of odds are:"<<l;
  getch();
}