1#include <stdio.h>
2
3
4int main(){
5
6 int base,power=1,exponent,expo;
7 double power2=1.0;
8
9 printf("Enter Base and exponent (3,2) : \n");
10 scanf("%d %d",&base,&exponent);
11 expo=exponent;
12
13 if(exponent > 0){
14 while(exponent != 0){
15 power*=base;
16 exponent--;
17 }
18 printf("%d to the power %d is %d",base,expo,power);
19 }else{
20 while(exponent != 0){
21 power2*=(1.0/base);
22 exponent++;
23 }
24 printf("%d to the power %d is %.10f",base,expo,power2);
25
26
27 }
28
29
30 return 0;
31
32
33}