// Wap to input a number. If the number is even then print its square otherwise print its cube.
#include<iostream.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
int main(void)
{
int a;
double b;
cout<<"Please enter a number: "<<"\n\n"<<endl;
cin >> a;
b = a%2 == 0 ? pow(a,2): pow(a,3);
cout << "The result is: " << b << endl;
system("pause");
}
#include<iostream.h>
#include<stdlib.h>
#include<math.h>
using namespace std;
int main(void)
{
int a;
double b;
cout<<"Please enter a number: "<<"\n\n"<<endl;
cin >> a;
b = a%2 == 0 ? pow(a,2): pow(a,3);
cout << "The result is: " << b << endl;
system("pause");
}
Comments
Post a Comment