case, until, for, pares, impares, primos, calculo de notas
program logicander;
uses wincrt;
var
opcion, i : integer;
respuesta : char;
ni, nii, prome : real;
nombre : string;
begin
WriteLn ( '1- Numeros pares' );
WriteLn ( '2- Numeros impares' );
WriteLn ( '3- Numeros primos' );
WriteLn ( '4- Calculo de notas' );
WriteLn ('');
WriteLn ( 'Ingrese una opcion' );
ReadLn (opcion);
case opcion of
1 : Begin
ClrScr;
Writeln('Numero Pares');
FOR i:=1 TO 10 DO
IF (i mod 2)=0 then
Writeln(i);
End;
2 : Begin
ClrScr;
Writeln('Numero Pares');
FOR i:=1 TO 10 DO
IF (i mod 2)=1 then
Writeln(i);
End;
3 : Begin
ClrScr;
Writeln('Numero Primos');
FOR i:=1 TO 10 DO
IF ((i mod 2)=1) and (i<>9) or (i=2) THEN
Writeln(i);
End;
4 : Begin
repeat
Begin
Writeln ( 'Ingrese el nombre del alumno' );
Readln (nombre);
Writeln ('');
writeln ( 'ingrese nota 1' );
readln (ni);
writeln ('');
writeln ( 'Ingrese nota 2' );
readln (nii);
prome:=(ni+nii)/2;
writeln ('');
writeln ( 'el promedio es: ', prome:5:2);
writeln ('');
writeln ( 'desea agregar otro S/N' );
readln (respuesta);
end;
until respuesta='N';
end;
end;
end.
Repita until, alumno 2 notas, promedio individual, ingresar otro alumno
program logicander;
Uses WinCrt;
Var
respuesta : char;
ni, nii, prome : real;
nombre : string;
Begin
Repeat
Begin
WriteLn ( 'Ingrese el nombre del alumno' );
ReadLn (nombre);
WriteLn ('');
WriteLn ( 'Ingrese nota 1' );
ReadLn (ni);
WriteLn ('');
WriteLn ( 'Ingrese nota 2' );
ReadLn (nii);
prome:= (ni+nii)/2;
WriteLn ('');
WriteLn ( 'El promedio es: ', prome:5:2);
WriteLn ('');
WriteLn ( '¿Desea agregar a otro alumno? S/N' );
ReadLn (respuesta);
end;
until respuesta='N';
end.
Uses WinCrt;
Var
respuesta : char;
ni, nii, prome : real;
nombre : string;
Begin
Repeat
Begin
WriteLn ( 'Ingrese el nombre del alumno' );
ReadLn (nombre);
WriteLn ('');
WriteLn ( 'Ingrese nota 1' );
ReadLn (ni);
WriteLn ('');
WriteLn ( 'Ingrese nota 2' );
ReadLn (nii);
prome:= (ni+nii)/2;
WriteLn ('');
WriteLn ( 'El promedio es: ', prome:5:2);
WriteLn ('');
WriteLn ( '¿Desea agregar a otro alumno? S/N' );
ReadLn (respuesta);
end;
until respuesta='N';
end.
Repita until, hasta x numero
program logicander;
Uses WinCrt;
Var
n : integer;
Begin
n:=1
WriteLn ( 'Hasta donde se repetira' );
ReadLn (x);
repeat
WriteLn (n);
n:= n+1:
until n<=x;
end.
Uses WinCrt;
Var
n : integer;
Begin
n:=1
WriteLn ( 'Hasta donde se repetira' );
ReadLn (x);
repeat
WriteLn (n);
n:= n+1:
until n<=x;
end.
Repita until, hasta 10
program logicander;
Uses WinCrt;
Var
n : integer;
Begin
n:=1;
repeat
WriteLn (n);
n:= n+1;
until n<11;
end.
Uses WinCrt;
Var
n : integer;
Begin
n:=1;
repeat
WriteLn (n);
n:= n+1;
until n<11;
end.
Repita until
program logicander;
Uses WinCrt;
Var
resp : char;
Begin
Repeat
WriteLn ( '¿Desea finalizar el programa? S/N' );
ReadLn (resp);
Until resp='N';
end.
III Parcial (Injusticia)
program logicander;
Uses WinCrt;
Var
opc, i, nt : integer;
suma, prom : real;
Begin
WriteLn ( 'Menu del exameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeen' );
WriteLn ( 'Presione 1 para el Sistema Numerico' );
WriteLn ( 'Presione 2 para el Calculo de Notas' );
ReadLn (opc);
if opc=1 then
Begin
Clrscr;
WriteLn ( 'Lista ordenada de 7 a 7 hasta 100 (sin numeros pares)' );
for i:= 7 to 100 do
if ((i mod 7)=0) and (i<>9) and (i<>11) and (i<>13) and (i<>14) and (i<>28) and (i<>42) and (i<>56) and (i<>70)
and (i<>84) and (i<>98) then
WriteLn (i);
end;
if opc=2 then
Begin
Clrscr;
WriteLn ( 'Calculo de Notas (Sumatoria de Promedio)' );
WriteLn ( '¿Cuantas notas son?' );
Readln (nt);
for i:= 1 to 4 do
begin
WriteLn ( 'Ingrese las notas' );
ReadLn (nt);
suma:= suma+nt;
prom:= suma/4;
end;
WriteLn ( 'La suma de las notas es: ', suma:5:3);
WriteLn ( 'El promedio es: ', prom:3:2);
if prom<10 then
writeln ( 'reprobado' )
else
if prom>10 then
Writeln ( 'aprobado' )
end;
end.
Calculo de Ingresos por horas
program logicander;
Uses WinCrt;
Var
n : integer;
hrd, csd, hrn, csn, td, tn, suma, ingreso : real;
Begin
WriteLn ( 'Cuantos trabajadores tiene la empresa' );
ReadLn (n);
For i:= 1 to n do
Begin
WriteLn ( 'Cuantas horas de trabajo al dia' );
ReadLn (hrd);
WriteLn ( 'Costo de la hora diurna' );
ReadLn (csd);
td:= hrd*csd;
WriteLn ( 'Cuantas horas de trabajo de noche' );
ReadLn (hrn);
WriteLn ( 'Costo de la hora nocturna' );
ReadLn (csn);
tn:= hrn*csn
ingreso:= td+tn
suma:= suma+ingreso
end;
WriteLn ( 'El pago a todos los empleados es: ', suma:5:3);
end.
Uses WinCrt;
Var
n : integer;
hrd, csd, hrn, csn, td, tn, suma, ingreso : real;
Begin
WriteLn ( 'Cuantos trabajadores tiene la empresa' );
ReadLn (n);
For i:= 1 to n do
Begin
WriteLn ( 'Cuantas horas de trabajo al dia' );
ReadLn (hrd);
WriteLn ( 'Costo de la hora diurna' );
ReadLn (csd);
td:= hrd*csd;
WriteLn ( 'Cuantas horas de trabajo de noche' );
ReadLn (hrn);
WriteLn ( 'Costo de la hora nocturna' );
ReadLn (csn);
tn:= hrn*csn
ingreso:= td+tn
suma:= suma+ingreso
end;
WriteLn ( 'El pago a todos los empleados es: ', suma:5:3);
end.
Suscribirse a:
Comentarios (Atom)