C Program Find N Power P

By | March 7, 2020

C Program Find N Power P

Output

Enter the number N=2
Enter the Power P=5
The number 2 raised to the power 5 is 32

#include<stdio.h>

int main()
{
    int n, i, p;
	
	long power=1;
    
	printf("Enter the number N=");
	scanf("%d", &n);
	
	printf("Enter the Power P=");
	scanf("%d", &p);
	
	for(i=1;i<=p;i++)
	  power = power * n;
	
	printf("The number %d raised to the power %d is %ld", n, p, power);
	
    return 0;
}

Loading

Leave a Reply

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