# Write a program which take input two no’s unless both no’s less than 250 and odd composite(which are not prime) no’s.

Explanation of Question: When you will enter the 1st then the compiler take the input of 1st no till you do not enter the no less than 250 and then compiler decide the given no is composite or no if the no is composite the compiler take the input till u do not enter odd composite no and then same case with 2nd no and then the program will return the average of no’s and the table of both no’s.

Don’t use goto statement.

I had done this program at dev C++  in turbo this program will give error.if u want to run this program in turbo please use iostream.h and remove (using namespace std;) and use one more header file #include<conio.h> and remove system(“pause”) and use getch(); and return 0; .

<——————————————————————————————————–>

#include<iostream>

using namespace std;

int main()

{

int a,b;

cout<<“Enter The 1st No: “<<endl;

cin>>a;

while( a>250 || a%2==0 )

{

cout<<“Please Enter the odd no less than 250: “<<endl;

cin>>a;

}

int i=0, j=2 ;

while ( j <= a/2 )

{

if( a % j == 0 )

{

i++;

}

j++;

}

while( i==0 && a!=1 || a%2==0)

{

cout<<“Please Enter The Odd Composite No: “<<endl;

cin>>a;

i=0,j=2;

if(a<250)

{

while ( j <= a/2 )

{

if( a % j == 0 )

{

i++;

}

j++;

}

}

else

cout<<“Plese Enter The 1st No Less Than 250 And “;

}

cout<<“Enter The Second No: “<<endl;

cin>>b;

while(b%2==0 || b>250)

{

cout<<“Please Enter The Odd no Less than 250: “<<endl;

cin>>b;

}

j=2;

i=0;

while ( j <= b/2 )

{

if( b % j == 0 )

{

i++;

}

j++;

}

while( i==0 && b!=1 || b%2==0  )

{

cout<<“Please Enter The Odd Composite No: “<<endl;

cin>>b;

if(b<250)

{

i=0,j=2;

while ( j <= b/2 )

{

if( b % j == 0 )

{

i++;

}

j++;

}

}

else

cout<<“Plese Enter The 2nd No Less Than 250 And “;

}

cout<<“1st Odd composite no is: “<<a<<endl;

cout<<“2nd Odd composite no is: “<<b<<endl;

cout<<“The average of two odd composite no’s is: “<<(a+b)/2<<endl;

cout<<“The Table of 1st Odd composite no “<<a<<” is :”<<endl;

int n=1,t;

while(n<=10)

{

cout<<a<<‘\t'<<n<<‘\t'<<a*n<<endl;

n++;

}

cout<<“The Table of 2nd Odd composite no “<<b<<” is :”<<endl;

n=1;

while(n<=10)

{

cout<<b<<‘\t'<<n<<‘\t'<<b*n<<endl;

n++;

}

system(“pause”);

}