C++ Program to square an even number or cube an odd number.

C++ Program to square an even number or cube an odd number.



#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"Enter a number: ";
cin>>a;
if(a%2==0)
cout<<"The sqaure is: "<<a*a;
else
cout<<"The cube is: "<<a*a*a;
getch();
}


Learn More :