/**********************************************************************
How to Get power of number in c
**********************************************************************/
#include<stdio.h>
int main(){
int power, number, i = 1;
long int sum = 1;
printf("\nEnter a number : ");
scanf("%d",&number);
printf("\nEnter power : ");
scanf("%d",&power);
while(i<=power){
sum = sum * number;
i++;
}
printf("\n%d to the powerer %d is: %ld",number, power, sum);
return 0;
}
/*
OUTPUT:
Enter a number : 11
Enter power : 2
11 to the powerer 2 is: 121
*/
Leave a Reply