Nov 28, 2014

Find ODD or EVEN

#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;
}

No comments:

Create a Diamond in C++

 #include<iostream> using namespace std; int main() { int i, j, k,r; cout<<"Enter the row of diamond   "; cin>>r...