Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define PERGUNTAS 5
- #define ALUNOS 10
- int main()
- {
- char G[PERGUNTAS];
- int i;
- for(i = 0; i < PERGUNTAS; i++) {
- printf("Insira a resposta da pergunta %d: ", i + 1);
- scanf(" %c", &G[i]);
- }
- printf("\n");
- char R[ALUNOS][PERGUNTAS];
- int j;
- for(i = 0; i < ALUNOS; i++) {
- for(j = 0; j < PERGUNTAS; j++) {
- printf("Insira a resposta da pergunta %d do aluno %d: ", j + 1, i + 1);
- scanf(" %c", &R[i][j]);
- }
- printf("\n");
- }
- int acertos,
- aprovados = 0;
- float media = 0;
- for(i = 0; i < ALUNOS; i++) {
- acertos = 0;
- for(j = 0; j < PERGUNTAS; j++) {
- if(G[j] == R[i][j]) {
- acertos++;
- media++;
- }
- }
- printf("Aluno %d -> %d/%d -> ", i + 1, acertos * 2, PERGUNTAS * 2);
- if(acertos * 2 < 6)
- printf("REPROVADO.\n");
- else {
- aprovados++;
- printf("APROVADO.\n");
- }
- }
- media /= ALUNOS * PERGUNTAS;
- media *= 10;
- printf("\nNumero de aprovados: %d\nNumero de reprovados: %d\nMedia da sala: %.2f", aprovados, ALUNOS - aprovados, media);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement