power of a number in c

In this example, I shared power of a number in c using for loop. Learn about for loop.

C Power of a Number

For example, User enters the base value 2 and exponent value 3 then the output of the following input is

 Enter base and exponent:- 2
 2 to the power 3 is 8

int main()
   int base,exponent,result=1,i; 
       printf("\n Enter base and exponent:-");
   printf("%d to the power %d is %d",base,exponent,result);
   return 0;

NOTE: You have any problem in above c program do not hesitate and write your problem in the comment box. I will support your problem.

No comments:

If you have any doubts, Please let me know

Powered by Blogger.