martes, 17 de julio de 2012

Notas

Program IUTCMnotas;
Uses WinCrt;
Var
P1, P2, P3, P4, total:integer;
nota, pro: real;
Begin

Writeln ('Cálculo de promedio en IUTCM');
Writeln ('Ingrese P1');
Readln (P1);
Writeln ('Ingrese P2');
Readln (P2);
Writeln ('Ingrese P3');
Readln (P3);
Writeln ('Ingrese P4');
Readln (P4);
total:=P1+P2+P3+P4;
pro:=total/4;
nota:=(pro*20)/100;
Writeln ('Total de cortes: ', total);
Writeln ('Promedio de cortes: ', pro:3:2);
Writeln ('Nota global es: ', nota:3:2);

If nota<10 then
Writeln ('Reprobado')
Else
If (nota>10) and (nota<12) then
Writeln ('Regular')
Else
If (nota>12) and (nota<14) then
Writeln ('Bueno')
Else
If (nota>14) and (nota<17) then
Writeln ('Sobresaliente')
Else
If nota>17 then
Writeln ('Excelente')
End.

Cálculo de edad

Program Age;
Uses WinCrt;
Var actual, nacimiento, edad, faltante: integer;
Begin


Writeln ('Ingrese actual');
Readln (actual);
Writeln ('Ingrese nacimiento');
Readln (nacimiento);
edad:=actual-nacimiento;
faltante:=18-edad;
Writeln ('La edad es: ', edad);
Writeln ('Le falta para ser mayor de edad: ', faltante);


If edad<18 then
Writeln ('Por lo tanto es menor de edad')
Else
Writeln ('Por lo tanto es mayor de edad')
End.

Repita para, par, impar, primo

Program Repita_para_menu_extendido;
Uses WinCrt;

Var i, j,op:integer;

Begin



Writeln ('****Menú repita para Hola****');

Writeln ('');

Writeln ('1-Ordenar por números pares ascendente');

Writeln ('2-Ordenar por números impares ascendente');

Writeln ('3-Ordenar por números primos ascendente');

Writeln ('4-Ordenar por números pares descendente');

Writeln ('5-Ordenar por números impares descendente');

Writeln ('6-Ordenar por números primos descendente');

Readln (op);



If op=1 then

Begin

ClrScr;

For i:= 1 to 10 do

If (i mod 2)=0 then

Writeln (i);

End;



If op=2 then

Begin

ClrScr;

For i:=1 to 10 do

If (i mod 2)=1 then

Writeln (i);

End;



If op=3 then

Begin

ClrScr;

For j:= 1 to 2 do

Writeln (j);

For i:=3to 10 do

If (i mod 2)=1 then

If (i<>9) then

Writeln (i)

End;



If op=4 then

Begin

ClrScr;

For i:=10 downto 1 do

If (i mod 2)=0 then

Writeln (i)

End;



If op=5 then

Begin

ClrScr;

For i:=10 downto 1 do

If (i mod 2)=1 then

Writeln (i)

End;



If op=6 then

Begin

ClrScr;

For i:=10 downto 3 do

If (i mod 2)=1 then

If (i<>9) then

Writeln (i);

For j:=2 downto 1 do

Writeln (j);

End;

End.

sábado, 14 de julio de 2012

Program Menutest02;
Uses WinCrt;
Var imc,peso,altura:real;
a,b,c,op:integer;
Begin


Writeln ('***Menú del Parcial II***');
Writeln ('1-Cálculo del IMC');
Writeln ('2-Comparar tres notas de 0 a 20');
Writeln ('3-No hay más opciones');
Readln (op);


If op=1 then
Begin
Writeln ('Cálculo del IMC');
Writeln ('Ingrese peso');
Readln (peso);
Writeln ('Ingrese altura');
Readln (altura);
imc:=peso/sqr(altura);
Writeln ('El IMC es: ', imc:4:2);


If (imc>16) and (imc<19) then
Writeln ('Muy delgado')
Else
If (imc>19) and (imc<22) then
Writeln ('Delgado')
Else
If (imc>22) and (imc<25) then
Writeln ('Normal')
Else
If (imc>25) and (imc<30) then
Writeln ('Goldito')
Else
If imc>30 then
Writeln ('Controle su peso')
End;


If op=2 then
Begin
Writeln ('Comparar tres notas de 0 a 20');
Writeln ('Ingrese a');
Readln (a);
Writeln ('Ingrese b');
Readln (b);
Writeln ('Ingrese c');
Readln (c);


If (a>b) and (a>c) then
Writeln ('Mayor es A')
Else
If (b>a) and (b>c) then
Writeln ('Mayor es B')
Else
If (c>a) and (c>b) then
Writeln ('Mayor es C')
End;


If op=3 then
Begin
Writeln ('No hay más opciones');
End;
End.

Repita For Hola, ingresando n Ascendiendo

Program repita_para_Hola;
Uses WinCrt;
Var n,i:integer;

Begin
Writeln ('Cuantas repeticiones para hola');
Writeln ('');
Writeln ('');
Writeln ('');
Writeln ('Ingrese n');
Readln (n);
For i:= 1 to n do;
Writeln ('hola i');
End.

Repita hola ingresando n descendiendo

Program Repita_para_hola;
Uses WinCrt;
Var i,n:integer;
Begin


Writeln ('Cuantas repeticiones para Hola');
Writeln ('');
Writeln ('');
Writeln ('');
Writeln ('Ingrese n');
Readln (n);
For i:= n downto 1 do
Writeln ('Hola', i);
End.

Repita For, Sumador, promedios y horas trabajadas

Program Repita_for_sumadores;
Uses WinCrt;
Var i,n,op:integer;
HD,HN,CHD,CHN,TOTALHD,TOTALHN,TOTALINGRESO,nota,promedio,suma:real;
Begin


Writeln ('***MENÚ LUCY SUMADOR***');
Writeln ('***1-Promedio ingresando cuantas notas***');
Writeln ('***2-Promedio ingresando cuantos alumnos***');
Writeln ('***3-Total de ingresos por horas ingresando número de trabajadores***');
Readln (op);
ClrScr;


If op=1 then
Begin
Writeln ('***Promedio ingresando cuantas notas***');
Writeln ('');
Writeln ('***Cuantas notas***');
Readln (n);
ClrScr;


For i:=1 to n do
Begin
Writeln ('***Ingrese nota***', i);
Readln (nota);
suma:=suma+nota;
End;
Writeln ('La suma es: ', suma:5:3);
promedio:=suma/n;
Writeln ('El promedio es: ', promedio:5:3);
End;


If op=2 then
Begin
Writeln ('***Promedio de la materia Lógica de Programación ingresando nro de alumnos***');
Writeln ('');
Writeln ('***Cuantos alumnos cursan la materia***');
Readln (n);
ClrScr;


For i:=1 to n do
Begin
Writeln ('***Ingrese nota***', i);
Readln (nota);
suma:=suma+nota;
End;
Writeln ('La suma es: ', suma:5:3);
promedio:=suma/n;
Writeln ('El promedio de la materia Lógica de Programación es: ', promedio:5:3);
End;


If op=3 then
Begin
Writeln ('***Ingreso total de trabajadores***');
Writeln ('');
Writeln ('***Ingrese número de trabajadores***');
Readln (n);
ClrScr;
For i:=1 to n do
Begin
Writeln ('***Cantidad de horas diurnas***');
Readln (HD);
Writeln ('***Costo de horas diurnas***');
Readln (CHD);
TOTALHD:=HD*CHD;
Writeln ('***Cantidad de horas nocturnas***');
Readln (HN);
Writeln ('***Costo de horas nocturnas***');
Readln (CHN);
TOTALHN:=HN*CHN;
TOTALINGRESO:=TOTALHD+TOTALHN;
suma:=suma+TOTALINGRESO;
End;


Writeln ('El ingreso total de trabajadores es de: ', suma:5:3);
End;
End.

Repita for menu

Program Repita_for_parcialIII;
Uses WinCrt;
Var i,n,op:integer;
suma,nota,promedio:real;
Begin


Writeln ('***MENÚ REPITA FOR - PARCIAL III***');
Writeln ('');
Writeln ('***********');
Writeln ('');
Writeln ('***1-Sistema de numeración, múltiplos de 7, sin pares***');
Writeln ('***2-Cálculo de notas***');
Readln (op);
ClrScr;


If op=1 then
Begin
Writeln ('***Sistema de numeración, múltiplos de 7, sin pares***');
Writeln ('');
For i:=1 to 100 do
If ((i mod 7)=0) and ((i mod 2)=1) then
Writeln (i);
End;


If op=2 then
Begin
Writeln ('***Cálculo de notas***');
Writeln ('');
Writeln ('***Ingrese número de notas***');
Readln (n);
ClrScr;
For i:=1 to n do
Begin
Writeln ('***Ingrese nota***');
Readln (nota);
suma:=suma+nota;
End;
Writeln ('***La sumatoria es: ***', suma:5:3);
promedio:=suma/n;
Writeln ('***El promedio es: ***', promedio:5:3);
If promedio<10 then
Writeln ('***Reprobado***')
Else
Writeln ('***Aprobado***')
End;


If (op<>1) and (op<>2) then
Writeln ('***Opción no válida***');
End.

Repita until basico 1 al 10

Program Repita_until2;
Uses WinCrt;
Var n:integer;
Begin
n:=1;
REPEAT
Writeln (n);
n:=n+1;
UNTIL n=11;
End.

repita until básico

Program Repita_until3;
Uses WinCrt;
Var n, x:integer;
Begin
n:=1;
Writeln ('***Hasta que número***');
Readln (x);
REPEAT
Writeln (n);
n:=n+1;
UNTIL n>x;
End.

viernes, 13 de julio de 2012

case 2

program casos;
uses wincrt;
var
 opcion, opcion2, i, n:integer;
 nombre: string;
 nota1, nota2, suma, promedio, total, final: real;
 horas_nocturnas, horas_diurnas, totalD, totalN, valor_diur, valor_noct, TOTALM: real;
 respuesta: char;
 valor1, valor2, suma2, resta, multiplicacion: real;


begin
Writeln ('Menu de Casos');
writeln ('');
writeln ('');
writeln ('Ingrese 1 para calcular Notas de alumnos');
Writeln ('Ingrese 2 para calculo de horas trabajadas');
writeln ('Ingrese 3 para Operaciones Matematicas ');
readln (opcion);
clrscr;

case opcion of

1: begin
 writeln (' Calculo Notas de alumnos');
 Repeat
 begin
 i:=i+1;
 writeln ('Ingrese el nombre del Alumno');
 readln (nombre);
 writeln ('Ingrese Nota1');
 readln (nota1);
 writeln ('Ingrese Nota2');
 readln (nota2);
 suma:= nota1+nota2;
 promedio:= suma/2;
 clrscr;
 writeln ('El promedio de', nombre ,' es: ', promedio:5:2);
 total:= total+promedio;
 writeln ('');
 writeln ('Desea agregar otro alumno');
 readln (respuesta);
 end;
 until respuesta='N';
 clrscr;
 final:= total/i;
 writeln ('El promedio total entre los alumnos es: ', final:5:2);
  end;

 2:
Begin
writeln ('          Calculo horas Trabajadas');
writeln ('');
writeln ('');
writeln (' ¿Cuantos Trabajadores tiene la Empresa? ');
readln (n);
clrscr;

for i:=1 to n do
begin
writeln ('Introduzca el numero de horas diurnas trabajadas ');
readln (horas_diurnas);
writeln ('Introduzca el valor de horas diurnas ');
readln (valor_diur);
writeln ('Introduzca el numero de horas nocturnas trabajadas');
readln (horas_nocturnas);
writeln ('Introduzca el valor de horas nocturnas ');
readln (valor_noct);
clrscr;
totalD:=(horas_diurnas*valor_diur);
totalN:= (horas_nocturnas*valor_noct);
TOTALM:= (totalD+totalN);
writeln ('');
writeln ('Total del Trabajador numero ', i);
writeln ('');
writeln ('El total segun las horas diurnas trabajas es: ', totalD:5:2);
writeln ('El total segun las horas nocturnas es: ', totalN:5:2);
writeln ('');
writeln ('El total de todas las horas trabajadas es: ', TOTALM:5:2);
writeln ('');
writeln ('');
end;
end;


3:Begin
clrscr;
writeln ('Menu Matematico');
writeln ('');
writeln ('Presione 1 para sumar');
writeln ('Presione 2 para restar');
writeln ('Presione 3 para multiplicar');
readln (opcion2);
clrscr;
if opcion2=1 then
begin
Writeln ('programa de Suma');
writeln ('');
writeln ('introduzcas numero uno');
readln (valor1);
writeln ('introduzcas numero dos');
readln (valor2);
suma2:= valor1+valor2;
writeln ('el resultado es:', suma:5:2);
end
 else
if opcion2 =2 then
begin
writeln ('programa de Resta');
writeln ('');
writeln ('introduzcas numero uno');
readln (valor1);
writeln ('introduzcas numero dos');
readln (valor2);
resta:= valor1-valor2;
writeln ('el resultado es:', resta:5:2);
end
 else
if opcion2=3 then
begin
writeln ('Programa de multiplicacion');
writeln ('');
writeln ('introduzcas numero uno');
readln (valor1);
writeln ('introduzcas numero dos');
readln (valor2);
multiplicacion:= valor1*valor2;
writeln ('el resultado es:', multiplicacion:5:2);
end
end;




end;

if (opcion<>1) and (opcion<>2) and (opcion<>3) then
writeln ('Opcion Invalida');

end.

ejercicio 37 repita repita

Program ejercicio;
Uses WinCrt;
Var
nombre:string;
respuesta:char;
ni, nii,promedio:real;
begin
repeat
begin
writeln ('Ingrese el nombre del alumno');
readln (nombre);
writeln ('Ingrese nota I');
readln (ni);
writeln ('Ingrese nota 2');
readln (nii);
promedio:=(ni+nii)/2;
writeln ('El promedio es ', promedio:5:2);
writeln ('');
writeln ('desea agregar otro alumno');
readln (respuesta); end;
until respuesta='N';
End.

jueves, 5 de julio de 2012

horas diurnas y nocturnas+notas, promedios

Program Repita_for_sumadores;
Uses WinCrt;
Var i,n,op:integer;
HD,HN,CHD,CHN,TOTALHD,TOTALHN,TOTALINGRESO,nota,promedio,suma:real;
Begin

Writeln('***Menulucysumador***');
Writeln('***1.-Promedio ingresando cuantas notas***');
Writeln('***2.-Promedio ingresando cuantos alumnos***');
Writeln('***3.-Total de ingresos por horas ingresandonúmeros de trabajadores***');
Readln (op);
ClrScr;

If op= 1 then
Begin
Writeln('***1.-Promedio ingresando cuantas notas***');
Writeln('');
Writeln('cuantas notas');
Readln(n);
ClrScr;
Suma:=suma+nota;
End;
Writeln ('la suma es: ', suma: 5:3');
promedio:=suma/n;
Writeln ('El Promedio es: ', promedio 5:3);
End;

If op=2 then
Begin
Writeln ('***Promedio de la materia Lógica de Programación ingresando nro de alumnos***');
Writeln ('');
Writeln ('***Cuantos alumnos cursan la materia***');
Readln (n);
ClrScr;


For i:=1 to n do
Begin
Writeln ('***Ingrese nota***', i);
Readln (nota);
suma:=suma+nota;
End;
Writeln ('La suma es: ', suma:5:3);
promedio:=suma/n;
Writeln ('El promedio de la materia Lógica de Programación es: ', promedio:5:3);
End;


If op=3 then
Begin
Writeln ('***Ingreso total de trabajadores***');
Writeln ('');
Writeln ('***Ingrese número de trabajadores***');
Readln (n);
ClrScr;
For i:=1 to n do
Begin
Writeln ('***Cantidad de horas diurnas***');
Readln (HD);
Writeln ('***Costo de horas diurnas***');
Readln (CHD);
TOTALHD:=HD*CHD;
Writeln ('***Cantidad de horas nocturnas***');
Readln (HN);
Writeln ('***Costo de horas nocturnas***');
Readln (CHN);
TOTALHN:=HN*CHN;
TOTALINGRESO:=TOTALHD+TOTALHN;
suma:=suma+TOTALINGRESO;
End;


Writeln ('El ingreso total de trabajadores es de: ', suma:5:3);
End;
End.

PRIMOS, PARES E IMPARES

Program Buuuuummmm;
Uses WinCrt;
Var i,op:integer;
Begin
Writeln('****Menú****');
Writeln('');
Writeln('Pulse 1 para número pares Ascendente');
Writeln('Pulse 2 para número impares Ascendentes');
Writeln('Pulse 3 para número primos Ascendentes');
Writeln('Pulse 4 para número pares Descendentes');
Writeln('Pulse 5 para número impares Descendentes');
Writeln('Pulse 6 para número primos Descentes');
Readln(op);
If op= 1 then
Begin
ClrScr;
Writeln('Número Pares Ascendente');
For i:= 1 TO 10 DO
If (i mod 2)=0 then
Writeln(i);
End;
If op= 2 then
Begin
ClrScr;
Writeln('Número impares Ascendente');
FOR i:=1 TO 10 DO
IF (i mod 2)= 1 then
Writeln(i);
End;
If op= 3 then
Begin
ClrScr;
Writeln('Número primos Ascendente');
FOR i:=1 TO 10 DO
IF(i mod 2)=1) and (i<>9)or (i =2)THEN
Writeln(i);;
End;
If op= 4 then
Begin
ClrScr;
Writeln('Número pares Descendente');
FOR i:=10 DOWNTO 1 DO
IF (i mod 2)=0 then
Writeln(i);
End;
If op= 5 then
Begin
ClrScr;
Writeln('Número impares Descendente');
FOR i:=10 DOWNTO 1 DO
IF (i mod 2)=1 then
Writeln(i);
End;
IF op= 6 then
Begin
ClrScr;
Writeln('Número primos Descendente');
FOR i:=10 DOWNTO 1 DO
IF (i mod 2)=1)and (1<>9)or (i =2)THEN
Writeln (i);;
End;
END.