sahajjain01

Square an even number or cube an odd number.

Aug 4th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. //Program to square an even number or cube an odd number.
  2. #include<iostream.h>
  3. #include<conio.h>
  4. void main()
  5. {
  6.     clrscr();
  7.     int a,b,c;
  8.     cout<<"Enter a number: ";
  9.     cin>>a;
  10.     if(a%2==0)
  11.     cout<<"The sqaure is: "<<a*a;
  12.     else
  13.     cout<<"The cube is: "<<a*a*a;
  14.     getch();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment