Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //IFF - Introdução à Programação
- //Slide - Página 47 - Exercício 3
- #include<stdio.h>
- #include<locale.h>
- int main(){
- int gabarito[8], respostas[8],nota,check=0;
- char nome[30];
- setlocale(LC_ALL,"Portuguese");
- for (int i=0;i<8;i++){
- if(check==0){
- printf("Entre com o %dª resposta do gabarito: ",i+1);
- scanf("%d",&gabarito[i]);
- if((gabarito[i]>5)||(gabarito[i]<1)){
- printf("\n\nEntre com um valor entre 1 e 5!\n\n");
- i--;
- }
- }
- if((i==7)&&(check==0)){
- i=0;
- check=1;
- setbuf(stdin,NULL);
- printf("\nEntre com o nome do aluno: ");
- gets(nome);
- }
- if(check==1){
- printf("Entre com a %dº respostas do aluno: ",i+1);
- scanf("%d",&respostas[i]);
- if(respostas[i]==gabarito[i]) nota++;
- }
- }
- if(nota>6) printf("\n\n%s foi Aprovado!",nome); else printf("\n\n%s foi Reprovado!",nome);
- }
Advertisement
Add Comment
Please, Sign In to add comment