Input
Enter a number : 3
Enter the expontial : 4
Output
Result = 81
Step 1: START
Step 2: Take a number as input.
Step 3: calculate power i.e pow(num).
Step 4: Print result
Step 5: END
/* Power of a number */
#include <stdio.h>
#include <math.h>
int main()
{
int base,expontial,result;
printf("Enter the base : ");
scanf("%d",&base);
printf("Enter the expontial : ");
scanf("%d",&expontial);
result=pow(base,expontial);
printf("results = %d\n",result);
return 0;
}
/* Power of a number */
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int base,expontial,result;
cout<<"Enter the base : ";
cin>>base;
cout<<"Enter the expontial : ";
cin>>expontial;
result=pow(base,expontial);
cout<<"results = "<<result;
return 0;
}
Enter a number : 3
Enter the expontial : 4
Result = 81
advertisment