#include<iostream>
using namespace std;
int main()
{
int min,max;
cout<<"\n\t******Find even and odd numbers in given range : ****"<<endl<<endl;
cout<<"Enter min number : ";
cin>>min;
cout<<"Enter max number : ";
cin>>max;
cout<<"\n";
cout<<"Even Numbers form "<<min<<" to " <<max <<" is : ";
for(int i=min;i<=max;i++)
{
if(i%2==0)
cout<<i<<", ";
}
cout<<endl<<endl;
cout<<"Odd Numbers form "<<min<<" to " <<max <<" is : ";
for(int j=min;j<=max;j++)
{
if(j%2!=0)
cout<<j<<", ";
}
cout<<endl;
return 0;
}
using namespace std;
int main()
{
int min,max;
cout<<"\n\t******Find even and odd numbers in given range : ****"<<endl<<endl;
cout<<"Enter min number : ";
cin>>min;
cout<<"Enter max number : ";
cin>>max;
cout<<"\n";
cout<<"Even Numbers form "<<min<<" to " <<max <<" is : ";
for(int i=min;i<=max;i++)
{
if(i%2==0)
cout<<i<<", ";
}
cout<<endl<<endl;
cout<<"Odd Numbers form "<<min<<" to " <<max <<" is : ";
for(int j=min;j<=max;j++)
{
if(j%2!=0)
cout<<j<<", ";
}
cout<<endl;
return 0;
}
No comments:
Post a Comment