Run Code
|
Code Wall
|
Users
|
Misc
|
Feedback
|
About
|
Login
|
Theme
|
Privacy
recursive fundamentos
//gcc 5.4.0 #include <stdio.h> int factorial(int n, int acc){ if ( n == 1){ return acc; } else{ return factorial(n-1,acc*n); } } int potencia( int n, int num,int acc){ if( n ==1){ return acc; } else{ return potencia(n-1,num,acc*num); } } int main(void){ int res = factorial ( 4,1); printf("%d\n", res); printf("%d",potencia(3,2,1)); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
A_141124arrayRepetidos
fgets and basic string manipulation
A_141117_Primo01
MergeSort
Calculate Area of Circle
Ultimo avance de pregunta 1 guía4
FUNCION strstr()
Warnings
Binary example
recurs2
Please log in to post a comment.