C program to find a power of the number.

 

01 #include<stdio.h>
02
03 int main()
04 {
05 int pow,num,i=1;
06 long int sum=1;
07
08 printf("Enter a number: ");
09 scanf("%d",&num);
10 printf("nEnter power: ");
11 scanf("%d",&pow);
12
13 while(i<=pow)
14 {
15 sum=sum*num;
16 i++;
17 }
18 printf("n%d to the power %d is: %ld",num,pow,sum);
19
20 return 0;
21 }
 
 
OUTPUT :

Enter a number: 4

Enter power: 3

4 to the power 3 is : 64

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.