program Registros;
type
    str20 = string[20];
    alumno = record
        codigo : integer;
        nombre : str20;
        promedio : real;
    end;
procedure leer(var alu : alumno);
begin
    writeln('Ingrese el código del alumno');
    read(alu.codigo);
    if (alu.codigo <> 0) then 
    begin
        writeln('Ingrese el nombre del alumno'); readln(alu.nombre);
        
        writeln('Ingrese el promedio del alumno'); readln(alu.promedio);
    end;
end;
{ declaración de variables del programa principal }
var
    a : alumno;
    contador: integer;
{ cuerpo del programa principal }
begin
    contador := 0;
    repeat
        leer(a);
        contador := contador + 1;
    until a.codigo = 0;
    writeln('La cantidad de alumnos leidos fueron: ', contador);
end. 

Pascal Online Compiler

Write, Run & Share Pascal code online using OneCompiler's Pascal online compiler for free. It's one of the robust, feature-rich online compilers for Pascal language. Getting started with the OneCompiler's Pascal editor is easy and fast. The editor shows sample boilerplate code when you choose language as Pascal and start coding.