Skip to content

Instantly share code, notes, and snippets.

@renoirtech
Created October 27, 2015 11:13
Show Gist options
  • Save renoirtech/f3ecc6c8fc16bca5c261 to your computer and use it in GitHub Desktop.
Save renoirtech/f3ecc6c8fc16bca5c261 to your computer and use it in GitHub Desktop.
Código que cria tabela de notas com média
/*
+---------+---------+---------+---------+--------+
| | 0 | 1 | 2 | 3 |
+---------+---------+---------+---------+--------+
| | Nota1 | Nota2 | Nota3 | Media |
+---------+---------+---------+---------+--------+
| | Nota1 | Nota2 | Nota3 | Media |
+---------+---------+---------+---------+--------+
| | Nota1 | Nota2 | Nota3 | Media |
+---------+---------+---------+---------+--------+
| | Nota1 | Nota2 | Nota3 | Media |
+---------+---------+---------+---------+--------+
| | Nota1 | Nota2 | Nota3 | Media |
+---------+---------+---------+---------+--------+
*/
#include <stdio.h>
int main () {
//declaração de variaveis
int notas[5][3],l=0,c=0,media=0;
char aluno[5];
//inserindo valores
for (l=0; l<4; l++) {
notas[l][3] = 0;
printf("\nCadastro do aluno %d:\n", l+1);
for (c=0; c<3; c++) {
printf("Digite a nota nº %d:\n", c+1);
scanf("%d", &notas[l][c]);
notas[l][3] = notas[l][3] + notas[l][c];
}
notas[l][3] = notas[l][3]/3;
printf("A média dessa fera é: %d", notas[l][3]);
}
}//fim do programa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment