C++ program – Sqrt & Power

by Nideesh C on May 1, 2011 · 0 comments

in C++




/* program to find sqrtn if n>0 & n5 if n<0 */
 #include<iostream.h>
 #include<math.h>
 #include<conio.h>
 void main()
 {
 clrscr();
 int n,r;
 cout<<"Enter no"<<endl;
 cin>>n;
 if((n>0)&&(n%2==1))
 r = sqrt (n);
 else if((n<0))
 r=pow(n,5);
 cout<<"Result ="<<r;
 getch();
 }  



Not Satisfied ? Just search & get the result

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

Related posts:

  1. C++ program – calculate a to the power b without using power function
  2. C++ program – Implementation of class
  3. Sample – Program to enter a sentence and output the number of uppercase & lowercase consonants, uppercase & lowercase vowels in sentence..
  4. C++ program – Swap two variables using function overloading
  5. Sample – convert temperatures

Leave a Comment

Previous post:

Next post: