ayuda con ejercicio!!!!
Publicado por marie (5 intervenciones) el 08/06/2016 04:30:14
ayudaa!! no me da errores pero solo me calcula el promedio de por estudiante y se cierra.
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
program ej_salon_notas;
{dadas las notas de los estudiantes, calcular promedio por: estudiante, salon y total}
uses crt;
var
nEstud, nMat,cont,salon,cont1,s1,s2,s3 : integer;
nota,notaf, pEstud,nSalon1,nSalon2,nSalon3,pSalon1,pSalon2,pSalon3,pCole : real;
begin
clrscr;
s1:=0;
s2:=0;
s3:=0;
nSalon1:=0;
nSalon2:=0;
nSalon3:=0;
writeln('Vamos a evaluar las notas de cuantos estudiantes?');
readln(nEstud);
writeln('');
writeln('Ok. Vamos a evaluar cada estudiante.');
cont1:=nEstud;
writeln('');
while cont1>0 do
begin
cont1:=cont1-1;
writeln('De que salon es el estudiante: 1, 2, 3?');
readln(salon);
writeln('');
writeln('Cuantas materias cursa el estudiante?');
readln(nMat);
writeln('');
writeln('Ingresa las notas: ');
notaf:=0;
cont:=nMat;
repeat
cont:= cont-1;
readln(nota);
notaf:=notaf+nota;
until cont=0;
pEstud:= notaf/nMat;
writeln('');
writeln('El promedio de eltudiante es: ', pEstud:5:2);
writeln('');
if (salon=1) then
begin
nSalon1:=nSalon1+pEstud;
s1:=s1+1;
end;
if (salon=2) then
begin
nSalon2:=nSalon2+pEstud;
s2:=s2+1;
end;
if (salon=3) then
begin
nSalon3:=nSalon3+pEstud;
s3:=s3+1;
end;
end;
pSalon1:=nSalon1/s1;
pSalon2:=nSalon2/s2;
pSalon3:=nSalon3/s3;
writeln('El promedio del salon 1 es: ', pSalon1:5:2);
writeln('');
writeln('El promedio del salon 2 es: ', pSalon2:5:2);
writeln('');
writeln('El promedio del salon 3 es: ', pSalon3:5:2);
writeln('');
pCole:=(pSalon1+pSalon2+pSalon3)/nEstud;
writeln('El promedio del colegio es:');
writeln(pCole:5:2);
readln;
end.
Valora esta pregunta
0