Tuesday 24 June 2014

47)write aprogram to evaluate the square cube and 4th power of a number

#include<iostream>
#include<cmath>
using namespace std;
int main()
{   int k;
    int x2,y3,z4;
   cout<<"enter the value of k"<<endl;
   cin>>k;
   x2=k*k;
   y3=x2*k;
   z4=y3*k;
   cout<<"the square  of k is "<<x2<<endl<<"the 3rd power of k is"<<y3<<endl<<"the 4th power of k is"<<z4;
   int i;
    cin>>i;
    return 0;
}

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...