Last active
August 29, 2015 14:19
-
-
Save rogerioagjr/99aa90f7cb1c59299ab8 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
#include <cstdio> // scanf e printf | |
int main(){ | |
int n, soma=0; // declaro a variável n e a variável soma com valor zero | |
scanf("%d", &n); // leio o número na tela e salvo em n | |
for(int i=1; i<=n; i++){ // repito n vezes o processo entre chaves | |
int davez; // declaro o inteiro davez | |
scanf("%d", &davez); // leio o valor na tela e salvo em davez | |
soma+=davez; // somo o valor de davez à variável soma | |
} | |
printf("%d\n", soma); // imprimo o valor de soma seguido da quebra de linha | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment