find A^B using Recursive function
Answers were Sorted based on User's Feedback
Answer / addu
#include<stdio.h>
double pow(int,int);
main()
{
int m,n;
double res;
printf("Enter the number and the power : ");
scanf("%d%d",&m,&n);
res=pow(m,n);
printf("\nThe result is = %d\n",res);
}
pow(int m,int n)
{
if(n>0)
{
return m* pow(m,n-1);
} else if (n==0){
return 1;
} else {
return (1/((double)m))*pow(m,n+1);
)
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / nagarajanselvaraj
#include<stdio.h>
int pow(int,int);
int r=1;
main()
{
int m,n,res;
printf("Enter the number and the power : ");
scanf("%d%d",&m,&n);
res=pow(m,n);
printf("\nThe result is = %d\n",res);
}
pow(int m,int n)
{
if(n>0)
{
r=r*m;
n--;
pow(m,n);
}
return r;
}
| Is This Answer Correct ? | 4 Yes | 2 No |
/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }
Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])
How to count a sum, when the numbers are read from stdin and stored into a structure?
Is it possible to print a name without using commas, double quotes,semi-colons?
how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!
write a c-program to display the time using FOR loop
what is oop?
main() { int i=5; printf("%d",++i++); }
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
How do you sort a Linked List (singly connected) in O(n) please mail to pawan.10k@gmail.com if u can find an anser...i m desperate to knw...
6 Answers Microsoft, MSD, Oracle,
C statement to copy a string without using loop and library function..
main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }