Skip to content

Instantly share code, notes, and snippets.

@ivanelson
Created December 14, 2018 14:14
Show Gist options
  • Save ivanelson/9c2ce1867ab4c96a34854765d895e553 to your computer and use it in GitHub Desktop.
Save ivanelson/9c2ce1867ab4c96a34854765d895e553 to your computer and use it in GitHub Desktop.
For loop in "C"
#include <stdio.h>
#include <stdlib.h>
void main() {
float nota, soma=0, media;
int conta;
for (conta = 0; conta <= 9; conta++) {
printf("Digite a nota: ");
scanf("%f", &nota);
soma = soma + nota;
} // Esta chave encerra o laco "for"
printf("\nValor de conta: %d", conta);
media = soma / conta;
printf("\nA media da turma eh: %f ", media);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment