#include <iostream>
using namespace std;
int temp=0;
class generation
{
int min,max;
public:
generation(int m1, int m2)
{
min=m1;
max=m2;
}
void odd();
void even();
};
void generation::odd()
{
cout<<"\n\nOdd Numbers in given Range are : ";
for(temp=min;temp<=max;temp++)
{
if(temp%2!=0)
cout<<temp<<" ";
}
cout<<"\n--------------------------------";
}
void generation::even()
{
cout<<"\n\nEven Numbers in given Range are : ";
for(temp=min;temp<=max;temp++)
{
if(temp%2==0)
cout<<temp<<" ";
}
}
int main()
{
int min,max;
cout<<"\nOdd and Even Number Generation.";
cout<<"\n--------------------------------";
cout<<"\n\nEnter the Minimum Range : ";
cin>>min;
cout<<"\nEnter the Maximum Range : ";
cin>>max;
cout<<"\n--------------------------------";
generation gen(min, max);
gen.odd();
gen.even();
return 0;
};
To embed this project on your website, copy the following code and paste it into your website's HTML: