Impares - Pares - Primos Con For

jueves, 19 de julio de 2012

PROGRAM lol;
        USES WINCRT;
        VAR i,op:Integer;
BEGIN
     Writeln('**Menu***');
     Writeln('');
     Writeln('Pulse 1 para los Numero Pares Ascendente');
     Writeln('Pulse 2 para los Numero Impares Ascendente');
     Writeln('Pulse 3 para los Numero Primos Ascendente');
     Writeln('Pulse 4 para los Numero Pares Descendente');
     Writeln('Pulse 5 para los Numero Impares Descendente');
     Writeln('Pulse 6 para los Numero Primos Descendente');
     Readln(op);
     If op= 1 then
     Begin
          ClrScr;
          {LES REGALE 5PTS}
          Writeln('Numero Pares Ascendente');
          FOR i:=1 TO 10 DO
          IF (i mod 2)=0 then
          Writeln(i);
     End;
     If op= 2 then
     Begin
          ClrScr;
          {OK YA AQUI LLEVAN 10PTS}
          Writeln('Numero Impares Ascendente');
          FOR i:=1 TO 10 DO
          IF (i mod 2)=1 then
          Writeln(i);
     End;
     If op= 3 then
     Begin
          ClrScr;
          Writeln('Numero Primos Ascendente');
          {EXTREMADAMENTE SENCILLO}
          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('Numero Pares Descendente');
          {NUEVO}
          FOR i:=10 DOWNTO 1 DO
          IF (i mod 2)=0 then
          Writeln(i);
     End;
     If op= 5 then
     Begin
          ClrScr;
          Writeln('Numero Impares Descendente');
          {NUEVO}
          FOR i:=10 DOWNTO 1 DO
          IF (i mod 2)=1 then
          Writeln(i);
     End;
      If op= 6 then
     Begin
          ClrScr;
          Writeln('Numero Primos Descendente');
          {NUEVO}
          FOR i:=10 DOWNTO 1 DO
          IF ((i mod 2)=1) and (i<>9) or (i=2) THEN
          Writeln(i);;
     End;
END.

0 comentarios:

Publicar un comentario

 
Richarth Flores © 2012 | Traduzido Por: Template Para Blogspot