Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Find power of any number using recursion | C program

#include<stdio.h>
int pow(int,int);

int main()
{
 int a,b;
 printf("Enter two values a and b : \n");
 scanf("%d %d",&a,&b);
 
 printf("a pow b = %d",pow(a,b));
 return 0;
}

int pow(int a,int b)
{
 if(b==1)
  return a;
 return (a*pow(a,b-1));
}
Bhuvan Arora

No comments:

Amazing Deal !