Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program legaj;
- uses crt;
- var
- legajo, nota, mejorNota, peorNota: integer;
- nombre, nombreMejorNota, nombrePeorNota: string;
- isFirstTime: Boolean;
- begin
- clrscr;
- isFirstTime := true;
- while ((legajo <> 0) or isFirstTime) do
- begin
- write('Ingrese legajo (finaliza con 0): ');
- readln(legajo);
- if (legajo <> 0) then
- begin
- write('Ingrese nombre: ');
- readln(nombre);
- write('Ingrese nota: ');
- readln(nota);
- if (isFirstTime) then
- begin
- mejorNota := nota;
- nombreMejorNota := nombre;
- peorNota := nota;
- nombrePeorNota := nombre;
- isFirstTime := false;
- end;
- if ((nota > mejorNota) and (legajo <> 0)) then
- begin
- mejorNota := nota;
- nombreMejorNota := nombre;
- end;
- if ((nota < peorNota) and (legajo <>0)) then
- begin
- peorNota := nota;
- nombrePeorNota := nombre;
- end;
- writeln();
- end;
- if (isFirstTime) then
- begin
- isFirstTime := false;
- end;
- writeln();
- end;
- if ((legajo <> 0) and (mejorNota <> peorNota)) then
- begin
- write('La mejor nota es ',mejorNota);
- writeln(' y corresponde a ', nombreMejorNota);
- write('La peor nota es ',peorNota);
- writeln(' y corresponde a ', nombrePeorNota);
- end;
- readln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement