  PROGRAM BECAS(imput,output);
Uses crt;
type
est = record
         ApellidosNombres: String [50];
           grado, lapso1 ,lapso2, lapso3, numero: integer;
           nota1L1, nota2L1, nota3L1, nota4L1, nota5L1, nota6L1 : real;
           nota1L2, nota2L2, nota3L2, nota4L2, nota5L2, nota6L2 : real;
           nota1L3, nota2L3, nota3L3, nota4L3, nota5L3, nota6L3 : real;
           PromL1, PromL2, PromL3, MBecaL1, MBecaL2, MBecaL3:real;
end;
estudiante = array[0..28] of Est;
VAR
n, opcion: integer;
E : estudiante;
i, x : integer;
Procedure incluir (var E: estudiante) ;



begin

  n :=0;
  i:=1;
   repeat
       writeln( 'Ingrese la cantidad de estudiantes a registrar');
   until(n>0);
   for i:=1 to n do begin
                 repeat
                   writeln ('Introduzca estudiante del primer grado');
                   writeln ('Introduzca los nombres y apellidos del estudiante numero:',i );
                   readln ( E[i].ApellidosNombres );
                    E[ i ]. grado:=1;
                    E[ i ]. lapso1:=1;
                    E[ i ]. Lapso2:=2;
                    E[ i ] .lapso3:=3;
                    E[ i ].numero:=i ;
                    writeln ('Introduzca las 5 notas del lapso 1');
                    readln (E[ i ].Nota1L1, E[ i ].Nota2L1, E[ i ].Nota3L1, E[ i ].Nota4L1, E [ i ].Nota5L1);
                    E[ i ]. PromL1:=(E[ i ].Nota1L1+ E[ i ].Nota2L1+ E[ i ].Nota3L1+ E[ i ].Nota4L1+ E[ i ].Nota5L1) /5;
                    If (E[ i ].PromL1 >=18) and (E[ i ]. PromL1<=20) then begin;
                        E[ i ].MBecaL1:= 55000;
                             If (E[ i ]. PromL1>=16) and (E[ i ]. PromL1 <18) then begin;
                                   E[ i ].MBecaL1:= 35000;
                              end;
                     end;
                    writeln ('Introduzca las 5 notas del lapso 2');
                    readln (E[ i ].Nota1L2, E[ i ].Nota2L2, E[ i ].Nota3L2, E[ i ].Nota4L2, E [ i ].Nota5L2);
                    E[ i ]. PromL2:=(E[ i ].Nota1L2+ E[ i ].Nota2L2+ E[ i ].Nota3L2+ E[ i ].Nota4L2+ E[ i ].Nota5L2) /5;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 55000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 35000;
                         End;
                    End;
                   writeln ('Introduzca las 5 notas del lapso 3');
                    readln (E[ i ].Nota1L3, E[ i ].Nota2L3, E[ i ].Nota3L3, E[ i ].Nota4L3, E [ i ].Nota5L3);
                    E[ i ]. PromL3:=(E[ i ].Nota1L3+ E[ i ].Nota2L3+ E[ i ].Nota3L3+ E[ i ].Nota4L3+ E[ i ].Nota5L3) /5;
                    If (E[ i ].PromL3 >=18) and (E[ i ]. PromL1<=20) then begin;
                        E[ i ].MBecaL3:= 55000;
                             If (E[ i ]. PromL3>=16) and (E[ i ]. PromL3 <18) then begin;
                                   E[ i ].MBecaL3:= 35000;
                          end;
                     end;
                                 writeln ( 'hasta el momento ha ingresado', i ,'estudiantes');
                                 writeln ( 'desea introducir otro estudiante del grado 1, presione 1, sino 0');
                    readln (x);
                 until(x=0);

                 repeat
                   writeln ('Introduzca estudiante del segundo grado');
                   writeln ('Introduzca los nombres y apellidos del estudiante numero:',i );
                   readln ( E[i].ApellidosNombres );
                    E[ i ].grado:=2;
                    E[ i ].lapso1:=1;
                    E[ i ].Lapso2:=2;
                    E[ i ].lapso3:=3;
                    E[ i ].numero:=i ;
                    writeln ('Introduzca las 5 notas del lapso 1');
                    readln (E[ i ].Nota1L1, E[ i ].Nota2L1, E[ i ].Nota3L1, E[ i ].Nota4L1, E [ i ].Nota5L1);
                    E[ i ]. PromL1:=(E[ i ].Nota1L1+ E[ i ].Nota2L1+ E[ i ].Nota3L1+ E[ i ].Nota4L1+ E[ i ].Nota5L1) /5;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 60000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 40000;
                            end;
                    end;
                    writeln ('Introduzca las 5 notas del lapso 2');
                    readln (E[ i ].Nota1L2, E[ i ].Nota2L2, E[ i ].Nota3L2, E[ i ].Nota4L2, E [ i ].Nota5L2);
                    E[ i ]. PromL2:=(E[ i ].Nota1L2+ E[ i ].Nota2L2+ E[ i ].Nota3L2+ E[ i ].Nota4L2+ E[ i ].Nota5L2) /5;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 60000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 40000;
                            End;
                    End;
                   writeln ('Introduzca las 5 notas del lapso 3');
                    readln (E[ i ].Nota1L3, E[ i ].Nota2L3, E[ i ].Nota3L3, E[ i ].Nota4L3, E [ i ].Nota5L3);
                    E[ i ]. PromL3:=(E[ i ].Nota1L3+ E[ i ].Nota2L3+ E[ i ].Nota3L3+ E[ i ].Nota4L3+ E[ i ].Nota5L3) /5;
                    If (E[ i ].PromL3 >=18) and (E[ i ]. PromL3<=20) then begin;
                        E[ i ].MBecaL3:= 60000;
                             If (E[ i ]. PromL3>=16) and (E[ i ]. PromL3 <18) then begin;
                                   E[ i ].MBecaL3:= 40000;
                          end;
                    end;
                                 writeln ( 'hasta el momento ha ingresado', i ,'estudiantes');
                                 writeln ( 'desea introducir otro estudiante del grado 2, presione 1, sino 0');
                    readln (x);
                until(x=0);


                repeat
                   writeln ('Introduzca estudiante del tercer grado');
                   writeln ('Introduzca los nombres y apellidos del estudiante nomero:',i );
                   readln ( E[i].ApellidosNombres );
                    E[ i ].grado:=3;
                    E[ i ].lapso1:=1;
                    E[ i ].Lapso2:=2;
                    E[ i ].lapso3:=3;
                    E[ i ].numero:=i ;
                    writeln ('Introduzca las 5 notas del lapso 1');
                    readln (E[ i ].Nota1L1, E[ i ].Nota2L1, E[ i ].Nota3L1, E[ i ].Nota4L1, E [ i ].Nota5L1);
                    E[ i ]. PromL1:=(E[ i ].Nota1L1+ E[ i ].Nota2L1+ E[ i ].Nota3L1+ E[ i ].Nota4L1+ E[ i ].Nota5L1) /5;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 65000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 45000;
                         end;
                    end;
                    writeln ('Introduzca las 5 notas del lapso 2');
                    readln (E[ i ].Nota1L2, E[ i ].Nota2L2, E[ i ].Nota3L2, E[ i ].Nota4L2, E [ i ].Nota5L2);
                    E[ i ]. PromL2:=(E[ i ].Nota1L2+ E[ i ].Nota2L2+ E[ i ].Nota3L2+ E[ i ].Nota4L2+ E[ i ].Nota5L2) /5;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 65000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 45000;
                        End;
                    End;
                   writeln ('Introduzca las 5 notas del lapso 3');
                    readln (E[ i ].Nota1L3, E[ i ].Nota2L3, E[ i ].Nota3L3, E[ i ].Nota4L3, E [ i ].Nota5L3);
                    E[ i ]. PromL3:=(E[ i ].Nota1L3+ E[ i ].Nota2L3+ E[ i ].Nota3L3+ E[ i ].Nota4L3+ E[ i ].Nota5L3) /5;
                    If (E[ i ].PromL3 >=18) and (E[ i ]. PromL3<=20) then begin;
                        E[ i ].MBecaL3:= 65000;
                             If (E[ i ]. PromL3>=16) and (E[ i ]. PromL3 <18) then begin;
                                   E[ i ].MBecaL3:= 45000;
                         end;
                     end;
                                 writeln ( 'hasta el momento ha ingresado', i ,'estudiantes');
                                 writeln ( 'desea introducir otro estudiante del grado 2, presione 1, sino 0');
                    readln (x);
                until(x=0);



                repeat
                   writeln ('Introduzca estudiante del cuarto grado');
                   writeln ('Introduzca los nombres y apellidos del estudiante nomero:',i );
                   readln ( E[i].ApellidosNombres );
                    E[ i ].grado:=4;
                    E[ i ].lapso1:=1;
                    E[ i ].Lapso2:=2;
                    E[ i ].lapso3:=3;
                    E[ i ].numero:=i ;
                    writeln ('Introduzca las 5 notas del lapso 1');
                    readln (E[i].Nota1L1, E[i].Nota2L1, E[i].Nota3L1, E[i].Nota4L1, E [i].Nota5L1, E [i].Nota6L1);
                    E[i]. PromL1:=(E[i].Nota1L1+ E[i].Nota2L1+ E[i].Nota3L1+ E[i].Nota4L1+ E[i].Nota5L1 + E[i].Nota6L1) /6;
                    If (E[ i ].PromL1 >=18) and (E[ i ]. PromL1<=20) then begin;
                        E[ i ].MBecaL1:= 70000;
                             If (E[ i ]. PromL1>=16) and (E[ i ]. PromL1 <18) then begin;
                                   E[ i ].MBecaL1:= 50000;
                        end;
                    end;
                    writeln ('Introduzca las 5 notas del lapso 2');
                    readln(E[i].Nota1L2, E[i].Nota2L2, E[i].Nota3L2, E[i].Nota4L2, E [i].Nota5L2, E [i].Nota6L2);
                    E[i].PromL1:=(E[i].Nota1L1+ E[i].Nota2L1+ E[i].Nota3L1+ E[i].Nota4L1+ E[i].Nota5L1 + E[i].Nota6L1) /6;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 70000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 50000;
                         End;
                     End;
                   writeln ('Introduzca las 5 notas del lapso 3');
                    readln(E[i].Nota1L3, E[i].Nota2L3, E[i].Nota3L3, E[i].Nota4L3, E [i].Nota5L3, E [i].Nota6L3);
                    E[i].PromL1:=(E[i].Nota1L3+ E[i].Nota2L3+ E[i].Nota3L3+ E[i].Nota4L3+ E[i].Nota5L3 + E[i].Nota6L3) /6;
                    If (E[ i ].PromL3 >=18) and (E[ i ]. PromL3<=20) then begin;
                        E[ i ].MBecaL2:= 70000;
                             If (E[ i ]. PromL3>=16) and (E[ i ]. PromL3 <18) then begin;
                                   E[ i ].MBecaL2:= 50000;
                         end;
                    end;
                                 writeln ( 'hasta el momento ha ingresado', i ,'estudiantes');
                                 writeln ( 'desea introducir otro estudiante del cuarto grado, presione 1, sino 0');
                    readln (x);
                until(x=0);



                repeat
                   writeln ('Introduzca estudiante del quinto grado');
                   writeln ('Introduzca los nombres y apellidos del estudiante nomero:',i );
                   readln ( E[i].ApellidosNombres );
                    E[ i ].grado:=5;
                    E[ i ].lapso1:=1;
                    E[ i ].Lapso2:=2;
                    E[ i ].lapso3:=3;
                    E[ i ].numero:=i ;
                    writeln ('Introduzca las 5 notas del lapso 1');
                    readln (E[i].Nota1L1, E[i].Nota2L1, E[i].Nota3L1, E[i].Nota4L1, E [i].Nota5L1, E [i].Nota6L1);
                    E[i]. PromL1:=(E[i].Nota1L1+ E[i].Nota2L1+ E[i].Nota3L1+ E[i].Nota4L1+ E[i].Nota5L1 + E[i].Nota6L1) /6;
                    If (E[ i ].PromL1 >=18) and (E[ i ]. PromL1<=20) then begin;
                        E[ i ].MBecaL1:= 75000;
                             If (E[ i ]. PromL1>=16) and (E[ i ]. PromL1 <18) then begin;
                                   E[ i ].MBecaL1:= 55000;
                        end;
                    end;
                    writeln ('Introduzca las 5 notas del lapso 2');
                    readln(E[i].Nota1L2, E[i].Nota2L2, E[i].Nota3L2, E[i].Nota4L2, E [i].Nota5L2, E [i].Nota6L2);
                    E[i].PromL1:=(E[i].Nota1L1+ E[i].Nota2L1+ E[i].Nota3L1+ E[i].Nota4L1+ E[i].Nota5L1 + E[i].Nota6L1) /6;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 75000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 55000;
                         End;
                     End;
                   writeln ('Introduzca las 5 notas del lapso 3');
                    readln(E[i].Nota1L3, E[i].Nota2L3, E[i].Nota3L3, E[i].Nota4L3, E [i].Nota5L3, E [i].Nota6L3);
                    E[i].PromL1:=(E[i].Nota1L3+ E[i].Nota2L3+ E[i].Nota3L3+ E[i].Nota4L3+ E[i].Nota5L3 + E[i].Nota6L3) /6;
                    If (E[ i ].PromL3 >=18) and (E[ i ]. PromL3<=20) then begin;
                        E[ i ].MBecaL2:= 75000;
                             If (E[ i ]. PromL3>=16) and (E[ i ]. PromL3 <18) then begin;
                                   E[ i ].MBecaL2:= 55000;
                         end;
                    end;
                                 writeln ( 'hasta el momento ha ingresado', i ,'estudiantes');
                                 writeln ( 'desea introducir otro estudiante del cuarto grado, presione 1, sino 0');
                    readln (x);
                until(x=0);

                repeat
                   writeln ('Introduzca estudiante del sexto grado');
                   writeln ('Introduzca los nombres y apellidos del estudiante nomero:',i );
                   readln ( E[i].ApellidosNombres );
                    E[ i ].grado:=6;
                    E[ i ].lapso1:=1;
                    E[ i ].Lapso2:=2;
                    E[ i ].lapso3:=3;
                    E[ i ].numero:=i ;
                    writeln ('Introduzca las 5 notas del lapso 1');
                    readln (E[i].Nota1L1, E[i].Nota2L1, E[i].Nota3L1, E[i].Nota4L1, E [i].Nota5L1, E [i].Nota6L1);
                    E[i]. PromL1:=(E[i].Nota1L1+ E[i].Nota2L1+ E[i].Nota3L1+ E[i].Nota4L1+ E[i].Nota5L1 + E[i].Nota6L1) /6;
                    If (E[ i ].PromL1 >=18) and (E[ i ]. PromL1<=20) then begin;
                        E[ i ].MBecaL1:= 80000;
                             If (E[ i ]. PromL1>=16) and (E[ i ]. PromL1 <18) then begin;
                                   E[ i ].MBecaL1:= 60000;
                        end;
                    end;
                    writeln ('Introduzca las 5 notas del lapso 2');
                    readln(E[i].Nota1L2, E[i].Nota2L2, E[i].Nota3L2, E[i].Nota4L2, E [i].Nota5L2, E [i].Nota6L2);
                    E[i].PromL1:=(E[i].Nota1L1+ E[i].Nota2L1+ E[i].Nota3L1+ E[i].Nota4L1+ E[i].Nota5L1 + E[i].Nota6L1) /6;
                    If (E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20) then begin;
                        E[ i ].MBecaL2:= 80000;
                             If (E[ i ]. PromL2>=16) and (E[ i ]. PromL2 <18) then begin;
                                   E[ i ].MBecaL2:= 60000;
                         End;
                     End;
                   writeln ('Introduzca las 5 notas del lapso 3');
                    readln(E[i].Nota1L3, E[i].Nota2L3, E[i].Nota3L3, E[i].Nota4L3, E [i].Nota5L3, E [i].Nota6L3);
                    E[i].PromL1:=(E[i].Nota1L3+ E[i].Nota2L3+ E[i].Nota3L3+ E[i].Nota4L3+ E[i].Nota5L3 + E[i].Nota6L3) /6;
                    If (E[ i ].PromL3 >=18) and (E[ i ]. PromL3<=20) then begin;
                        E[ i ].MBecaL2:= 80000;
                             If (E[ i ]. PromL3>=16) and (E[ i ]. PromL3 <18) then begin;
                                   E[ i ].MBecaL2:= 60000;
                         end;
                    end;
                                 writeln ( 'hasta el momento ha ingresado', i ,'estudiantes');
                                 writeln ( 'desea introducir otro estudiante del cuarto grado, presione 1, sino 0');
                    readln (x);
                until(x=0);
  end;
 readkey;
end;

 procedure consultar (var E: estudiante; n : integer) ;
VAR
i, grado, lapso :integer;
ApellidosNombres: String [50];
begin
  grado:=0;
  lapso:=0;
  i:=1;
  x:=1;
   repeat
     writeln( 'Ingrese el nombre y apellido del estudiante a consultar');
     readln ( ApellidosNombres );
     writeln( 'Ingrese el grado cursado del estudiante');
     readln ( grado);
     writeln( 'Ingrese el lapso cursado del estudiante');
     readln ( lapso);
      for i:=1 to n do begin
          if(E [ i ]. ApellidosNombres=ApellidosNombres)then begin;
             if(E [ i ]. grado=grado)then begin;
                if(E [ i ]. lapso1=lapso)then begin;

                  writeln( 'Los datos del estudiante es el siguiente');
                  writeln( 'Total Estudiantes:',n);
                  writeln( 'Alumno numero:',E[ i ]. numero,'Apellidos y Nombres:',E [ i ]. ApellidosNombres);
                  writeln( 'grado:',E [ i ]. grado);
                  writeln( 'lapso:',E [ i ]. lapso1);
                  writeln( 'Las notas son:');
                  writeln( 'Materia 1:',E[ i ]. Nota1L1);
                  writeln( 'Materia 2:',E [ i ]. Nota2L1);
                  writeln( 'Materia 3:',E [ i ]. Nota3L1);
                  writeln( 'Materia 4:',E[ i ]. Nota4L1);
                  writeln( 'Materia 5:',E[ i ]. Nota5L1);
                  writeln( 'Materia 6:',E [ i ]. Nota6L1);
                  writeln( 'Promedio de notas:',E[ i ]. PromL1);
                  writeln( 'Promedio de notas:',E [ i ]. MbecaL1);
                 end;
              end;
          end;

                  if(E [ i ]. ApellidosNombres=ApellidosNombres)then begin;
                    if(E [ i ]. grado=grado)then begin;
                     if(E [ i ]. lapso2=lapso)then begin;

                      writeln( 'Los datos del estudiante es el siguiente');
                      writeln( 'Total Estudiantes:',n);
                      writeln( 'Alumno numero:',E [ i ]. numero,'Apellidos y Nombres:',E [ i ]. ApellidosNombres);
                      writeln( 'grado:',E[ i ]. grado);
                      writeln( 'lapso:',E[ i ]. lapso2);
                      writeln( 'Las notas son:');
                      writeln( 'Materia 1:',E [ i ]. Nota1L2);
                      writeln( 'Materia 2:',E [ i ]. Nota2L2);
                      writeln( 'Materia 3:',E[ i ]. Nota3L2);
                      writeln( 'Materia 4:',E[ i ]. Nota4L2);
                      writeln( 'Materia 5:',E [ i ]. Nota5L2);
                      writeln( 'Materia 6:',E [ i ]. Nota6L2);
                      writeln( 'Promedio de notas:',E [ i ]. PromL2);
                      writeln( 'Promedio de notas:',E[ i ]. MbecaL2);
                    end;
                 end;
             end;


                     if(E [ i ]. ApellidosNombres=ApellidosNombres)then begin;
                        if(E [ i ]. grado=grado)then begin;
                          if(E [ i ]. lapso3=lapso)then begin;

                      writeln( 'Los datos del estudiante es el siguiente');
                      writeln( 'Total Estudiantes:',n);
                      writeln( 'Alumno numero:',E [ i ]. numero,'Apellidos y Nombres:',E [ i ]. ApellidosNombres);
                      writeln( 'grado:',E[ i ]. grado);
                      writeln( 'lapso:',E [ i ]. lapso3);
                      writeln( 'Las notas son:');
                      writeln( 'Materia 1:',E[ i ]. Nota1L3);
                      writeln( 'Materia 2:',E[ i ]. Nota2L3);
                      writeln( 'Materia 3:',E[ i ]. Nota3L3);
                      writeln( 'Materia 4:',E[ i ]. Nota4L3);
                      writeln( 'Materia 5:',E[ i ]. Nota5L3);
                      writeln( 'Materia 6:',E [ i ]. Nota6L3);
                      writeln( 'Promedio de notas:',E [ i ]. PromL3);
                      writeln( 'Promedio de notas:',E [ i ]. MbecaL3);
                    end;
                 end;
             end;
          end;
      until (x= 0)

    end;



    
    procedure reporte1 (var E: estudiante) ;
VAR
          ApellidosNombres: String [50];
          subtotal, subtotalpagar, grado,lapso, :real;




BEGIN

   grado:=0;
   lapso:=0;
   subtotal:=0;
   subtotalpagar:=0;
   x:=1;
   i:=1;
       repeat
          writeln( 'Introduzca el grado a consultar');
          readln ( grado );
          writeln( 'Introduzca el lapso a consultar');
          readln ( lapso);
          writeln( 'Total alumnos con promedio entre 18 y 20');
          writeln( 'Apellido y nombre*******Grado******Lapso******Promedio*******Monto Beca Bs');
          for i:=1 to n do begin

              if(E [ i ]. grado = grado)then begin;
                if(E [ i ]. lapso1 = lapso)then begin;
                 if(E[ i ].PromL1 >=18) and (E[ i ]. PromL1<=20)then begin;
                 Subtotal:= Subtotal + 1 ;
                 Subtotalpagar:= Subtotalpagar + E[ i ]. MBecaL1  ;

       writeln (E [ i ].Apellidosnombres,'******',E[i].grado,'******', E [ i ].lapso1,'******',E[ i ].PromL1,'******', E [ i ]. MBecaL1 );

                 end;
               end;
             end;

             if(E [ i ]. grado = grado)then begin;
                if(E [ i ]. lapso2 = lapso)then begin;
                   if(E[ i ].PromL2 >=18) and (E[ i ]. PromL2<=20)then begin;
                   Subtotal:= Subtotal + 1;
                   Subtotalpagar:= Subtotalpagar + E [ i ]. MBecaL2 ;

       writeln( E[ i ].Apellidosnombres,'******', E [ i ].Grado,'******', E [ i ]. Lapso2,'******',E[ i ].PromL2,'******', E [ i ]. MBecaL2 );

                 end;
               end;
             end;
             if(E [ i ]. grado = grado)then begin;
                if(E [ i ]. lapso3 = lapso)then begin;
                   if(E[ i ].PromL3 >=18) and (E[ i ]. PromL3<=20)then begin;
                   Subtotal:= Subtotal + 1 ;
                   Subtotalpagar:= Subtotalpagar + E [ i ]. MBecaL3 ;

       writeln( E [ i ].Apellidosnombres,'******', E [ i ].Grado,'******', E [ i ]. Lapso3,'******',E[ i ].PromL3,'******', E[ i ]. MBecaL3);

                 end;
               end;
             end;
           end;
       writeln( 'Total',Subtotal,'Total a Pagar', Subtotalpagar);
       writeln( 'desea introducir otro grado a consultar, presione 1, sino presione 0');
      readln ( x );
     until(x=0);
     readkey;
end;
    procedure reporte2 (var E: estudiante) ;
VAR
          ApellidosNombres: String [50];
          subtotal, subtotalpagar, grado,lapso, :real;



BEGIN

   grado:=0;
   lapso:=0;
   subtotal:=0;
   subtotalpagar:=0;
   x:=1;
   i:=1;
       repeat
          writeln( 'Introduzca el grado a consultar');
          readln ( grado );
          writeln( 'Introduzca el lapso a consultar');
          readln ( lapso);
          writeln( 'Total alumnos con promedio entre 18 y 20');
          writeln( 'Apellido y nombre*******Grado******Lapso******Promedio*******Monto Beca Bs');
          for i:=1 to n do begin

              if(E [ i ]. grado = grado)then begin;
                if(E [ i ]. lapso1 = lapso)then begin;
                 if(E[ i ].PromL1 >=16) and (E[ i ]. PromL1<18)then begin;
                 Subtotal:= Subtotal + 1 ;
                 Subtotalpagar:= Subtotalpagar + E[ i ]. MBecaL1  ;

       writeln (E[ i ].Apellidosnombres,'******',E[i].grado,'******',E[ i ].lapso1,'******', E[ i ].PromL1,'******', E[ i ]. MBecaL1 );

                 end;
               end;
             end;

             if(E [ i ]. grado = grado)then begin;
                if(E[ i ]. lapso2 = lapso)then begin;
                   if(E[ i ].PromL2 >=16) and (E[ i ]. PromL2<18)then begin;
                   Subtotal:= Subtotal + 1;
                   Subtotalpagar:= Subtotalpagar + E [ i ]. MBecaL2 ;

       writeln( E [ i ].Apellidosnombres,'******', E [ i ].Grado,'******', E[ i ]. Lapso2,'******',E[ i ].PromL2,'******', E[ i ]. MBecaL2 );

                 end;
               end;
             end;
             if(E[ i ]. grado = grado)then begin;
                if(E [ i ]. lapso3 = lapso)then begin;
                   if(E[ i ].PromL3 >=16) and (E[ i ]. PromL3<18)then begin;
                   Subtotal:= Subtotal + 1 ;
                   Subtotalpagar:= Subtotalpagar + E [ i ]. MBecaL3 ;

       writeln( E [ i ].Apellidosnombres,'******', E [ i ].Grado,'******', E[ i ]. Lapso3,'******',E[ i ].PromL3,'******', E [ i ]. MBecaL3);

                 end;
               end;
             end;
           end;
       writeln( 'Total',Subtotal,'Total a Pagar', Subtotalpagar);
       writeln( 'desea introducir otro grado a consultar, presione 1, sino presione 0');
      readln ( x );
     until(x=0);

end;

   begin
   readkey;
   end.
   begin
    repeat
         writeln( 'Bienvenidos al programa de asignacin de becas');
         writeln( 'a traves del siguiente men, escoger la opcion con la cual desea Trabajar');
         writeln( '1.-Para incluir estudiante presione 1');
         writeln( '2.-Para Consultar estudiante presione 2');
         writeln( '3.-Para mostrar reporte R1 presione 3');
         writeln( '4.-Para mostrar reporte R2 presione 4');
         writeln( '5.-Para salir presione 5');
         readln (opcion);
         case opcion of
         1: Incluir (E, n);
         2: consultar (E, n);
         3: ReporteR1;
         4: ReporteR2;
         5= writeln('llama a la funcion salir');

           End;
    Until (opcion=5);

    begin
    Until keypressed
    end.
