potencia recursiva
/*Escribir una función recursiva que calcule x^y mediante multiplicaciones
sucesivas, siendo x e y dos números enteros. */
int potencia(int x, int y){
int res = x;
if(y == 0){ //caso base
res = 1;
}else if(y == 1){
res = x;
}else{
res = res * potencia(x, y - 1);
}
printf("potencia: %d\n", res);
return res;
}
Also in C:
- how to use a pointer as a parameter in c
- c calloc
- strncpy c
- molotovn't ribbentropn't pact
- reap zombie process in c
- windows block application au demarrage regegit
- typedef in c
- rakshabandhan 2020
- allocating memory for 1Mb text file in C
- gura
- double return type in c
- delete docker image repository none
- With a suitable example, explain increment, decrement and compound assignment operators
- If statement that tests if a value is in range
- download file by command line windows
- int to double c
- visual studio code
- program using if statement in c whether numnber is less eqaul to greater than 50
- Hamming Distance ErrorDetection And Correction method c implementation
- how to use malloc in c
- what is strikethrough in markdown
- cmd command with c
- atoi c
- strtok