Вы находитесь на странице: 1из 6

program Project2; {$APPTYPE CONSOLE} uses SysUtils; VAR N1,N2,N3,nn,n,CONT:INTEGER; begin { TODO -oUser -cConsole Main : Insert code

here } N1:=0; N2:=1; N3:=1; nn:=0; cont:=0; write('ingrese n : '); readln(n) ; if n=1 then write(' ',n1) else if n=2 then write(' ',n1,' ',n2 ) else if n=3 then write(' ',n1,' ',n2,' ',n3) else if n >3 then begin while cont<=n do begin Nn:=N1+N2+N3; N1:=n2; n2:=n3; n3:=nn; CONt:=CONt+1 ; end; end; write(' ',n1,' ',n2,' ',n3); readln; end.

program Project2; {$APPTYPE CONSOLE} uses SysUtils; VAR suma1,suma2,num1,num2,x,n,cont:INTEGER;

prom1,prom2:double; begin { TODO -oUser -cConsole Main : Insert code here } suma1:=0; suma2:=0; num1:=0; num2:=0; cont:=1; write('ingrese el numero de estudiantes : ') ; readln(n); write(' edad del estudiante : ') ; read(x); while n >= cont do begin if x>=21 then begin cont:=cont+1; suma1:=suma1+x; num1:=num1+1 ; writeln(' edad del estudiante : ') ; readln(x) end else cont:=cont+1; suma2:=suma2+1; num2:=num2 + 1; writeln(' edad del estudiante : ') ; read(x) end; prom1:=suma1/num1; prom2:=suma2/num2; write('el promedio de los mayores a 21: ',prom1:5:2,' el promedio de los demas es ',prom2:5:2); readln; end.

program Project3; {$APPTYPE CONSOLE} uses SysUtils; var v1,v2,vn,con,n:integer; begin

writeln('INGRESE EL NUMERO DE TERMINOS : '); readln(N); V1 :=1; V2 :=2; Vn :=0; con :=2; if N > 0 then begin writeln(' ',V1,' ',v2); readln; while con < N do begin if N > 2 then begin con:= con + 1; Vn := V1 + V2; V1 := V2; V2 := Vn; writeln(' ',Vn); readln; end end end; end.

program Project3; {$APPTYPE CONSOLE} uses SysUtils; var n1,n2,n3,nn,cont,n:integer; begin N1:=0; N2:=1; N3:=1; nn:=0; cont:=2; write('ingrese n : '); readln(n) ; if n=1 then begin write(' ',n1); readln; end else if n=2 then begin write(' ',n1,' ',n2 ); readln; end else

if n=3 then begin write(' ',n1,' ',n2,' ',n3); readln; end else begin write(' ',n1,' ',n2,' ',n3); readln; while cont<(n-1) do begin if n >3 then begin Nn:=N1+N2+N3; N1:=n2; n2:=n3; n3:=nn; CONt:=CONt+1 ; write(' ',nn); readln; end; end; end;

program Project2; {$APPTYPE CONSOLE} uses SysUtils; VAR suma1,suma2,num1,num2,x,n,cont:INTEGER; prom1,prom2:double; begin { TODO -oUser -cConsole Main : Insert code here } suma1:=0; suma2:=0; num1:=0; num2:=0; write('ingrese el numero de estudiantes : ') ; readln(n); write(' edad del estudiante : ') ; read(x); begin for cont:=1 to (n-1) do if x>21 then begin suma1:=suma1+x; num1:=num1+1 ; writeln(' edad del estudiante : ') ; readln(x) end

else begin suma2:=suma2+x; num2:=num2 + 1; writeln(' edad del estudiante : ') ; read(x); end; end; prom1:=suma1/num1; prom2:=suma2/num2; write('el promedio de los mayores a 21: ',prom1:5:2,' el promedio de los demas es ',prom2:5:2); readln; end.

program Project2; {$APPTYPE CONSOLE} uses SysUtils; VAR suma1,suma2,num1,num2,x,n,cont:INTEGER; prom1,prom2:double; begin { TODO -oUser -cConsole Main : Insert code here } suma1:=0; suma2:=0; num1:=0; write('ingrese el numero de estudiantes : ') ; readln(n); begin for cont:=1 to n do begin write(' edad del estudiante : ') ; readln(x); if x>21 then begin suma1:=suma1+x; num1:=num1+1; end else begin suma2:=suma2+x; end end; end; prom1:=(suma1/num1); prom2:=(suma2/(n-num1));

write('la sumade >21 es : ',prom1:5:2,' la suma de < 21 es : ',prom2:5:2); readln; end.

Вам также может понравиться