answersLogoWhite

0


Best Answer

int pow (int a, int b)

{

if (b==0) return 1;

else return a*pow(a,b-1);

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Recursive program for a power b in c language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between function and recursive function?

I will explain in the easiest way the difference between the function and recursive function in C language. Simple Answer is argument of the function is differ but in the recursive function it is same:) Explanation: Function int function(int,int)// function declaration main() { int n; ...... ...... n=function(a,b); } int function(int c,int d) { ...... ...... ...... } recursive Function: int recursive(int,int)// recursive Function declaration main() { int n; ..... ..... ..... ..... n=recursive(a,b); } int recursive(int a,int b) { ..... .... .... .... } Carefully see, In the recursive Function the function arguments are same.


What is XOR in a c program?

a XOR b is a^b in C language


What has the author B L Meek written?

B. L. Meek has written: 'Fortran, PL/I, and the algols' -- subject(s): ALGOL (Computer program language), FORTRAN (Computer program language), PL/I (Computer program language)


How do you write a C program to find the GCD of two given integers using non recursive functions?

Use the following function: int gcd (int a, int b) { while (b != 0) { a %= b; a ^= b ^= a ^= b; } return a; } Note that a ^= b ^= a ^= b is an efficient method of swapping two values.


Write a program to find gcd using recursive method in java?

for two positive integers: public static int gcd(int i1, int i2) { // using Euclid's algorithm int a=i1, b=i2, temp; while (b!=0) { temp=b; b=a%temp; a=temp; } return a; }


Why C program is called as 'C'?

The language was called the "C" language because it was a kind of successor of the "B" language.


Biggest of three nos using recursive method?

biggest3 (a,b,c) = biggest2 (a, biggest2 (b,c))


What has the author K Lano written?

K. Lano has written: 'Specification in B' -- subject(s): B (Computer program language)


What has the author B Legrand written?

B. Legrand has written: 'APL' -- subject(s): APL (Computer program language), Problems, exercises


Write a program in 'C' language to accept 6 strings as input and print them in lexicographic?

(ab)*b


Program to find a raised to the power b without recursion?

It's pow from math.h


Write a program in c language to find the value of a raised to power b where a and b are natural numbers using while loop?

You can do it simpler just by using preprocessor directive#include void main(){int a, b;cout > a;cout > b;cout b;for (int i =1; i