-
Notifications
You must be signed in to change notification settings - Fork 1
/
1118.c
46 lines (46 loc) · 1.03 KB
/
1118.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
main()
{
int opcao;
float nota, soma = 0, notaacc = 0, i, j;
for (i = 0;; i++)
{
scanf("%f", ¬a);
if (nota < 0.0 || nota > 10.0)
{
printf("nota invalida\n");
}
else
{
soma += nota;
notaacc++;
}
if (notaacc == 2)
{
printf("media = %.2f\n", (soma / 2));
printf("novo calculo (1-sim 2-nao)\n");
do
{
scanf("%d", &opcao);
if (opcao < 1 || opcao > 2)
{
printf("novo calculo (1-sim 2-nao)\n");
}
else if (opcao == 1)
{
notaacc = 0;
soma = 0;
}
else if (opcao == 2)
{
break;
}
} while (opcao > 2.0 || opcao < 1.0);
}
if (opcao == 2)
{
break;
}
}
system("pause");
}