You are on page 1of 1

WAP to accept a number and if it is even print its

square otherwise cube


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,r;
cout<<"\nenter your number";
cin>>a;
r=((a/2)%==0)?(a*a):(a*a*a);
cout<<"\nresult is"<<r;
getch();
}

If number is even

If number is odd

You might also like