C program to raise the maximum to the power of another number

C program to raise the maximum to the power of another number:

Here I shared C program of performing to raise the maximum to the power of another number using a For Loop statement.

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

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





#include<stdio.h>
int main()
{             
   int base,exponent,result=1,i; 
       printf("\n Enter base and exponent:-");
 scanf("%d%d",&base,&exponent);
       for(i=1;i<=exponent;i++)
   {
     result=base*result;
   }
   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.

Share this

0 Comment to "C program to raise the maximum to the power of another number"

Post a Comment