write a c++ program to input a number. if the number is even, print its square otherwise print its cube.
Answers
Answered by
1
See correctly modify it a little bit ,use the same header files!! And voila u will get it!
Attachments:
Answered by
5
int a;
cout<<"Enter a number : ";
cin>>a;
if(a%2==0)
{
cout<<"The number"<<a<<"is even and its square is :"<<a*a;
}
else
{
cout<<"The number"<<a<<"is odd and its cube is :"<<a*a*a;
}
getch();
}
cout<<"Enter a number : ";
cin>>a;
if(a%2==0)
{
cout<<"The number"<<a<<"is even and its square is :"<<a*a;
}
else
{
cout<<"The number"<<a<<"is odd and its cube is :"<<a*a*a;
}
getch();
}
Similar questions