answersLogoWhite

0

int pow (int a, int b)

{

if (b==0) return 1;

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

}

User Avatar

Wiki User

15y ago

What else can I help you with?

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


What is the recursive formula for A B C?

The recursive formula for a sequence typically defines each term based on previous terms. For a sequence denoted as ( A(n) ), ( B(n) ), and ( C(n) ), a common recursive approach might be: ( A(n) = A(n-1) + B(n-1) ) ( B(n) = B(n-1) + C(n-1) ) ( C(n) = C(n-1) + A(n-1) ) These formulas assume initial values are provided for ( A(0) ), ( B(0) ), and ( C(0) ). Adjustments can be made based on the specific context or properties of the sequence.


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

It's pow from math.h