martes, 17 de julio de 2012

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.

No hay comentarios:

Publicar un comentario