Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define tam 10
  4. int main ()
  5. {
  6. char gab[tam], resp;
  7. int num,i,acertos, j;
  8. printf("GABARITO\n");
  9. for(i = 0; i < 10; i++)
  10. {
  11. printf("Questão %d: ", i+1);
  12. scanf("%c", &gab[i]);
  13. }
  14. printf("NÚMERO DE ALUNOS DA TURMA: ");
  15. scanf("%d", &num);
  16. fgetc(stdin);
  17. for( i = 0; i < num; i++)
  18. {
  19. acertos = 0;
  20. for( j = 0; j < tam; j++)
  21. {
  22. printf("Resposta do aluno à questão %d: ", j+1);
  23. scanf("%c", &resp);
  24. if( resp == gab[j] )
  25. {
  26. acertos++;
  27. }
  28. }
  29. printf("O aluno %d acertou %d questões!", i+1, acertos);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement