Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to square an even number or cube an odd number.
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int a,b,c;
- cout<<"Enter a number: ";
- cin>>a;
- if(a%2==0)
- cout<<"The sqaure is: "<<a*a;
- else
- cout<<"The cube is: "<<a*a*a;
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment