Program to find even and odd numbers between 100 and 200.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int d1=100;
int d2=200;
cout<<"This Program will display Even and Odd numbers between "<<d1<<" and "<<d2<<".\n";
cout<<"\nEven Numbers : \n";
for(int i=d1;i<=d2;i++)
{
if(i%2==0)
{
cout<<"\t"<<i;
}
}
cout<<"\n\nOdd Numbers : \n";
for(int j=d1;j<=d2;j++)
{
if(j%2!=0)
{
cout<<"\t"<<j;
}
}
getch();
}
OUTPUT :
No comments:
Post a Comment