Advertisement
joaoantoniodornelas

Prática 11- Parte 1

Nov 13th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. float media(int *vetor, int n, int tam){
  2.     if(n <= 0){
  3.         return 0;
  4.     }
  5.     else{
  6.         return vetor[n-1]/(float)tam + media(vetor, n-1, tam);
  7.     }
  8. }
  9.  
  10. int soma(int vetor[], int tam){
  11.     if(tam <= 0){
  12.         return 0;
  13.     }
  14.  
  15.     else{
  16.         return soma(int vetor[], int tam - 1) + vetor[n - 1];
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement