Program to calculate power of a number in c language.

program:-

#include<stdio.h>
#include<conio.h>

//function definition power

int pow(int a,int n)
{
if(n==0)
return 1;
else
return a*pow(a,n1);
}
void main()
{
int a,n,p;
printf(“Enter number and it’s power”);
scanf(“%d%d”,&a,&n);
p=pow(a,n); //function calling
printf(“result=%d”,p);
getch();
}


     

13 thoughts on “Program to calculate power of a number in c language.

Leave a Reply

Your email address will not be published.