Created
September 14, 2019 22:35
-
-
Save Pharaoh00/cae91090b5d1d8e23f4f89b617c6d80a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int subRotinaEx30(int* vetor, int qtd, bool ordem){ | |
// Ordem é a maneira que será imprimida. | |
// true = vetor[0], vetor[1], ..., vetor[n-1] | |
// false = vetor[n-1], ..., vetor[1], vetor[0] | |
int sum = 0; | |
if(qtd < 0){ | |
return 0; | |
} | |
if(ordem == true){ | |
subRotinaEx30(vetor, qtd - 1, ordem); | |
printf("%d ", vetor[qtd]); | |
sum += vetor[qtd]; // soma normal | |
} | |
else if(ordem == false){ | |
printf("%d ", vetor[qtd]); | |
subRotinaEx30(vetor, qtd - 1, ordem); | |
sum += vetor[qtd]; | |
} | |
return sum; // retorna o valor | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment