#include <iostream>
using namespace std
int main()
{
int number
cout<<"Enter the number. The number must be between 1 and 30\n"
cin>>number
if(number < 1 || number >30 ){
cout<<"Enter a number between 1 and 30\n"
main()
}
int n
cout<<"Enter the operation you want to perform from the menu. Enter 1 or 2 or 3\n"
cout<<" 1. Calculate whether the number is odd or even. \n"
cout<<" 2. Cube the number. \n"
cout<<"3. Calculate an area of circle using the number as radius\n"
cin>>n
switch(n){
case 1:
if(number % 2== 0)
{
cout<<"The entry is even\n"
}
else{
cout<<"The entry is odd \n"
}
break
case 2: cout<<"The area of the cube is \t"<<number * number * number<<endl
break
case 3: cout<<"The of the circle is \t"<< 3.142 * number * number <<endl
break
default:
cout<<"The number is valid\n"
}
return 0
}
Comments