Write a program to enter two unequal numbers . if the first number is greater than display square of the smaller number and cube of the greatr number otherwise , vice-versa. if the numbers are equal , display the massage "both the numbers are equal".
Answers
Explanation:
program for c++ . header files math.h, iostream.h,conio.h
Answer:
cin>>a;
cin>>b;
If(a>b)
{
cout<<b*b<<"\n";
cout<<a*a*a;
}
else if(b<a)
{
cout<<a*a<<"\n";
cout<<b*b*b;
}
else
cout<<"both the numbers are equal";
Explanation:
I have used the c++ language. I have just written the programming part and have excluded the main() and the header files. Coming to the description of the code, it is a simple program. First input 2 numbers as a and b. An if statement is used to check if a is greater than b or not. If a is grater than b, the program will return the smaller number's square and bigger number's cube. Otherwise, if b is greater than a, then the program will print the square of the greater number and cube of the smaller number. If both a and b are equal, the program will print a message that both the numbers are equal.