Skip to content

Instantly share code, notes, and snippets.

@joffilyfe
Created January 18, 2015 00:40
Show Gist options
  • Save joffilyfe/4122ce6c65a56519f19a to your computer and use it in GitHub Desktop.
Save joffilyfe/4122ce6c65a56519f19a to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(void) {
float entrada, notaUm, notaDois;
int i, pergunta;
i = pergunta = 0;
do {
pergunta = i = 0;
do {
scanf("%f", &entrada);
if (entrada >= 0 && entrada <= 10 && i < 2) {
if (i == 0) {
notaUm = entrada;
i++;
} else {
notaDois = entrada;
i++;
}
} else {
printf("nota invalida\n");
}
} while ( i < 2);
printf("media = %0.2f\n", (notaUm + notaDois) / 2);
while (printf("novo calculo (1-sim 2-nao)\n") && scanf("%d", &pergunta) && (pergunta != 1) && pergunta != 2);
} while(pergunta == 1);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment