diogoAlves

IFF/Introdução à Programação/Slide/Pag 47/Ex 3

Mar 4th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.85 KB | None | 0 0
  1. //IFF - Introdução à Programação
  2. //Slide - Página 47 - Exercício 3
  3. #include<stdio.h>
  4. #include<locale.h>
  5.  
  6. int main(){
  7.     int gabarito[8], respostas[8],nota,check=0;
  8.     char nome[30];
  9.     setlocale(LC_ALL,"Portuguese");
  10.     for (int i=0;i<8;i++){
  11.         if(check==0){
  12.             printf("Entre com o %dª resposta do gabarito: ",i+1);
  13.             scanf("%d",&gabarito[i]);
  14.             if((gabarito[i]>5)||(gabarito[i]<1)){
  15.                 printf("\n\nEntre com um valor entre 1 e 5!\n\n");
  16.                 i--;
  17.             }
  18.         }
  19.         if((i==7)&&(check==0)){
  20.             i=0;
  21.             check=1;
  22.             setbuf(stdin,NULL);
  23.             printf("\nEntre com o nome do aluno: ");
  24.             gets(nome);
  25.         }
  26.         if(check==1){
  27.             printf("Entre com a %dº respostas do aluno: ",i+1);
  28.             scanf("%d",&respostas[i]);
  29.             if(respostas[i]==gabarito[i]) nota++;
  30.         }
  31.     }
  32.     if(nota>6) printf("\n\n%s foi Aprovado!",nome); else printf("\n\n%s foi Reprovado!",nome);
  33.    
  34. }
Advertisement
Add Comment
Please, Sign In to add comment