C++ program – Square or Cube According Input

by Nideesh C on May 1, 2011 · 0 comments

in C++




/* program to find sq + cube acc to input */
 #include<iostream.h>
 #include<conio.h>
 void main()
 {
 clrscr();
 int n,s;
 cout<<"Enter a no"<<endl;
 cin>>n;
 if((n%2)==0)
 s=n*n;
 else
 s=n*n*n;
 cout<<"Rsult = "<<s;
 getch();
 }  



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. Sample – compute square roots using Newton’s method
  2. Sample – Program to identify if an input is a symbol, digit or character.
  3. C++ program – Implementation of class
  4. Sample – Program to enter an integer and output the cube of that integer.
  5. Sample – Program to find the sum of each row & column of a matrix of size n x m and if matrix is square, find the sum of the diagonals also..

Leave a Comment

Previous post:

Next post: