Você está na página 1de 11

ESCUELA CANGALLO

Programacin Estructurada: Pascal


Trabajo Prctico 7
Nicols Kudach y Manuel Carrasco 11/11/2011

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_1; USES CRT; VAR Op : string; suma : integer; Product : integer; N : integer; BEGIN clrscr; suma:= 0; Product:= 1; REPEAT BEGIN writeln('Ingrese nota'); readln(N); suma:= suma + N; Product := Product*N; writeln('Desea ingresar una nota? S/N'); readln(Op); END UNTIL OP = 'S'; writeln('La suma es: ', suma); writeln('El producto es: ',Product); readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_2; USES CRT; VAR N : integer; BEGIN clrscr; FOR N:=1 TO 50 DO BEGIN IF ( N MOD 2 = 0) THEN BEGIN writeln(N); delay(1000); END END; readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_2b; USES CRT; VAR N,minValue,maxValue: integer; BEGIN clrscr; writeln('Ingerese Primer Valor'); readln(minValue); writeln('Ingerese Segundo Valor'); readln(maxValue); IF minValue < maxValue THEN FOR N:=minValue TO maxValue DO BEGIN IF ( N MOD 2 = 0) THEN writeln(N); END; ELSE writeln('Incongruencia en los datos ingresados'); readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_3a; USES CRT; VAR N, suma : integer; producto : longint; BEGIN clrscr; producto := 1; FOR N:=1 TO 50 DO BEGIN suma := suma+N; writeln(N); producto := producto*N; END; writeln('La suma es: ', suma); writeln('El producto es: ', producto); readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_3b; USES CRT; VAR N, suma : integer; producto : longint; minValue, maxValue : integer; BEGIN clrscr; writeln('Ingerese primer valor'); readln(minValue); writeln('Ingerese segundo valor'); readln(maxValue); IF minValue < maxValue THEN BEGIN producto := 1; FOR N:=minValue TO maxValue DO BEGIN suma := suma+N; producto := producto*N; END; writeln('La suma es: ', suma); writeln('El producto es: ', producto); END ELSE writeln('Incongruencia en los datos ingresados.'); readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_4a; USES CRT; VAR I,A,B : integer; BEGIN clrscr; writeln('Ingrese A'); readln(A); writeln('Ingrese B'); readln(B); IF A < B THEN BEGIN FOR I:= A TO B DO IF (I MOD 3= 0) THEN Writeln(I); END; readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_4b; USES CRT; VAR I,A,B,C : integer; BEGIN clrscr; writeln('Ingrese A'); readln(A); writeln('Ingrese B'); readln(B); writeln('Ingrese C'); readln(C); IF A < B THEN BEGIN FOR I:= A TO B DO IF (I MOD C= 0) THEN Writeln(I, ' : Es mltiplo de ', C); END ELSE writeln('Incongruencia en los datos ingresados.'); readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_5; USES CRT; VAR N : real; NMayor : real; BEGIN clrscr; NMayor := 0; REPEAT writeln('Ingrese su nmero real. Se detendr cuando sea -1'); readln(N); IF (NMayor < N) THEN NMayor := N; UNTIL N = -1; writeln('El Numero mayor ingresado es ', NMayor:0:2); readln; END.

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ_7_6; (*versin boolean *) USES CRT; VAR N,NMay,NMen: real; answer : char; primerNumero : boolean; BEGIN clrscr; NMay := 0; NMen := 0; primerNumero := FALSE; REPEAT writeln('Desea ingresar un numero? S/N'); readln(answer); IF (answer = 'S') THEN BEGIN Writeln('Ingrese su nmero'); Readln(N); IF (primerNumero = FALSE) THEN BEGIN primerNumero := TRUE; NMen := N; END; IF (NMay < N) THEN NMay := N; IF (NMen > N) THEN NMen := N; END UNTIL answer <> 'S'; writeln('El mayor nmero es: ', NMay:0:2); writeln('El menor nmero es: ', NMen:0:2); readln; END.

10

Nicols Kudach y Manuel Carrasco 4to Informtica - 2011


PROGRAM EJ7_6; USES CRT; VAR N,NMay,NMen: real; answer : char; BEGIN clrscr; writeln('Desea ingresar un nmero? S/N'); readln(answer); IF (answer = 'S') THEN BEGIN Writeln('Ingrese su nmero'); Readln(N); NMay:= N; NMen:= N; REPEAT writeln('Desea ingresar un nmero? S/N'); readln(answer); IF (answer = 'S') THEN BEGIN Writeln('Ingrese su nmero'); Readln(N); IF (NMay < N) THEN NMay := N; IF (NMen > N) THEN NMen := N; END UNTIL answer <> 'S'; writeln('El mayor nmero es: ', NMay:0:2); writeln('El menor nmero es: ', NMen:0:2); END ELSE Writeln ('Lo lamentamos'); readln; END.

11

Você também pode gostar