write a program in c++ to read a number n and print n^2,n^3,n^4
Answers
Answered by
6
#include<iostream.h>
#include<math.h>
#include<conio.h>
void main()
{
clrscr();
float n,p,q,r;
cout<<"Enter the number,whose 2nd ,3rd and 4th power is to be found\n\n";
cin>>n;
p=pow(n,2)
q=pow(n,3)
r=pow(n,4)
cout<<" The 2nd 3rd and 4th power of" <<n <<"is :"<<p","<<q<<","<<r<<"respectively";
getch();
}
_____________
End of program
Hope it Helps...
Regards,
Leukonov
#include<math.h>
#include<conio.h>
void main()
{
clrscr();
float n,p,q,r;
cout<<"Enter the number,whose 2nd ,3rd and 4th power is to be found\n\n";
cin>>n;
p=pow(n,2)
q=pow(n,3)
r=pow(n,4)
cout<<" The 2nd 3rd and 4th power of" <<n <<"is :"<<p","<<q<<","<<r<<"respectively";
getch();
}
_____________
End of program
Hope it Helps...
Regards,
Leukonov
mahima1888:
thank you
Similar questions