-
Lenguaje
Pascal
-
Descripción
Entrar por pantalla los datos de 8 estudiantes: código, nombre, edad, cal1, cal2, cal3, estrato (puede tener un valor de 1-6), valor de matrícula. Se pide:
a) Total de estudiantes de estrato 3 con edad mayor a 19 años que aprobaron el curso.
b) Total de estudiantes de estrato cinco (5) o estrato 6 menores de 18 años que reprobaron el curso.
c) Total general de matrículas.
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
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
program MatriculaDe8Estudiantes;
uses crt;
var a, b, i : integer;
var c, cal1, cal2, cal3, edad : real;
var estrato, matricula, promedio : real;
var codigo, nombre : string;
begin
a := 0;
b := 0;
c := 0;
for i:=1 to 8 do
begin
writeln ('PROCESO ', i);
write ('Ingresa el codigo: ');
readln (codigo);
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el valor de cal1: ');
readln (cal1);
write ('Ingresa el valor de cal2: ');
readln (cal2);
write ('Ingresa el valor de cal3: ');
readln (cal3);
write ('Ingresa el valor de edad: ');
readln (edad);
write ('Ingresa el valor de estrato: ');
readln (estrato);
write ('Ingresa el valor de matricula: ');
readln (matricula);
promedio := (cal1+cal2+cal3)/3;
if (estrato=3) and (edad>19) and (promedio>=7) then
begin
a := a+1;
end;
if ((estrato=5) or (estrato=6)) and (edad<18) and (promedio<7) then
begin
b := b+1;
end;
c := c+matricula;
writeln ('Codigo: ', codigo);
writeln ('Nombre: ', nombre);
writeln ('Valor de promedio: ', promedio:0:6);
writeln;
end;
writeln ('Valor de a: ', a);
writeln ('Valor de b: ', b);
writeln ('Valor de c: ', c:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.
uses crt;
var a, b, i : integer;
var c, cal1, cal2, cal3, edad : real;
var estrato, matricula, promedio : real;
var codigo, nombre : string;
begin
a := 0;
b := 0;
c := 0;
for i:=1 to 8 do
begin
writeln ('PROCESO ', i);
write ('Ingresa el codigo: ');
readln (codigo);
write ('Ingresa el nombre: ');
readln (nombre);
write ('Ingresa el valor de cal1: ');
readln (cal1);
write ('Ingresa el valor de cal2: ');
readln (cal2);
write ('Ingresa el valor de cal3: ');
readln (cal3);
write ('Ingresa el valor de edad: ');
readln (edad);
write ('Ingresa el valor de estrato: ');
readln (estrato);
write ('Ingresa el valor de matricula: ');
readln (matricula);
promedio := (cal1+cal2+cal3)/3;
if (estrato=3) and (edad>19) and (promedio>=7) then
begin
a := a+1;
end;
if ((estrato=5) or (estrato=6)) and (edad<18) and (promedio<7) then
begin
b := b+1;
end;
c := c+matricula;
writeln ('Codigo: ', codigo);
writeln ('Nombre: ', nombre);
writeln ('Valor de promedio: ', promedio:0:6);
writeln;
end;
writeln ('Valor de a: ', a);
writeln ('Valor de b: ', b);
writeln ('Valor de c: ', c:0:6);
write ('Presiona una tecla para terminar . . . ');
readkey;
end.