Advertisement
Guest User

Untitled

a guest
May 19th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.51 KB | None | 0 0
  1. program legaj;
  2. uses crt;
  3.  
  4. var
  5. legajo, nota, mejorNota, peorNota: integer;
  6. nombre, nombreMejorNota, nombrePeorNota: string;
  7. isFirstTime: Boolean;
  8.  
  9. begin
  10.   clrscr;
  11.   isFirstTime := true;
  12.   while ((legajo <> 0) or isFirstTime) do
  13.     begin
  14.       write('Ingrese legajo (finaliza con 0): ');
  15.       readln(legajo);
  16.       if (legajo <> 0) then
  17.         begin
  18.           write('Ingrese nombre: ');
  19.           readln(nombre);
  20.           write('Ingrese nota: ');
  21.           readln(nota);
  22.           if (isFirstTime) then
  23.             begin
  24.               mejorNota := nota;
  25.               nombreMejorNota := nombre;
  26.               peorNota := nota;
  27.               nombrePeorNota := nombre;
  28.               isFirstTime := false;
  29.             end;
  30.           if ((nota > mejorNota) and (legajo <> 0)) then
  31.             begin
  32.               mejorNota := nota;
  33.               nombreMejorNota := nombre;
  34.             end;
  35.           if ((nota < peorNota) and (legajo <>0)) then
  36.             begin
  37.               peorNota := nota;
  38.               nombrePeorNota := nombre;
  39.             end;
  40.         writeln();
  41.         end;
  42.         if (isFirstTime) then
  43.         begin
  44.           isFirstTime := false;
  45.         end;
  46.       writeln();
  47.     end;
  48.     if ((legajo <> 0) and (mejorNota <> peorNota)) then
  49.       begin
  50.         write('La mejor nota es ',mejorNota);
  51.         writeln(' y corresponde a ', nombreMejorNota);
  52.         write('La peor nota es ',peorNota);
  53.         writeln(' y corresponde a ', nombrePeorNota);
  54.       end;
  55.     readln();
  56. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement