Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 1 - implemente uma funรงao recursiva que recebe x e n, calcule
- o valor de x;
- 2 - implemente uma funรงao recursi va que recebe um vetor x, seu tamanho t
- e retorna a soma dos valores de x.
- 3 - mdc (x,y)=?
- mdc(x-y,y), se x>y
- mdc(y,x) se x<y
- mdc(x,x)=x
- 4 - implemente a funรงao recursiva soma(n) que retorna o somatorio dos n primeiro numeros
- a partir de 1*/
- //1 -
- #include <stdio.h>
- int pot(int x, int n){
- if(n==0) return(1);
- else return(x*pot(x,n-1));
- }
- //2
- #include <stdio.h>
- int exerc(int x[], int n){
- if(n==0) return(0);
- else return x[n-1]+exerc(x,n-1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement