Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Finding power using recursion
#include<stdio.h> float power(int,int); int main() { int x,y; printf("Enter two numbers\n"); scanf("%d%d",&x,&y); printf("%d to the power %d is %f",x,y,power(x,y)); return 0; } float power(int x, int y) { if(y==0) return 1; else if(y>0) return (x*power(x,y-1)); else return ((1/x)*power(x,y-1)); }
run
|
edit
|
history
|
help
0
Maximum
Simple Calculator v1.0
h
Assignment 7
B_141104_TresPuntosTriangulo
Assignment 5
Assignment 8
Check EOF Value
a
20171127_ARRAY_ValorMayor