#include<iostream.h>
#include<conio.h>
#include<math.h> //for pow() function
void main()
{
clrscr();
int x,n,res;
cout<<"\n Enter value of x : ";
cin>>x;
cout<<"\n Enter value of n : ";
cin>>n;
res=pow(x,n); //to calculate power
cout<<"\n\t Result = "<<res;
getch();
}
Output

#include<conio.h>
#include<math.h> //for pow() function
void main()
{
clrscr();
int x,n,res;
cout<<"\n Enter value of x : ";
cin>>x;
cout<<"\n Enter value of n : ";
cin>>n;
res=pow(x,n); //to calculate power
cout<<"\n\t Result = "<<res;
getch();
}
Output
No comments:
Post a Comment