1.- PROGRAMA
program promedioNvalores;
uses
crt;
type
vector=array [1..100] of integer;
var
arreglo:vector;
cantidad,cont,suma:integer;
begin
ClrScr;
writeln('PROGRAMA QUE CALCULA EL PROMEDIO DE "N" VALORES');
writeln;
write('Cantidad de valores: ');Readln(cantidad);
writeln;
suma:=0;
for cont:=1 to cantidad do
begin
Write('Valor ',cont,': ');Readln(arreglo[cont]);
end;
for cont:=1 to cantidad do
begin
suma:=suma+arreglo[cont];
end;
Write('promedio: ',suma/cantidad:0:2);
ReadKey;
end.
CORRIDA DEL PROGRAMA.

2.- PROGRAMA
program mayorymenordelvector;
uses
crt;
type
vector=array [1..100] of integer;
var
arreglo:vector;
cantidad,cont1,cont2,temp1,temp2:integer;
begin
ClrScr;
writeln('PROGRAMA QUE MUESTRA EL MAYOR Y EL MENOR DE LOS VALORES DE UN VEC.');
writeln;
Write('Cantidad de valores: ');Readln(cantidad);
writeln;
for cont1:=1 to cantidad do
begin
Write('Valor ',cont1,': ');Readln(arreglo[cont1]);
end;
for cont1:=cantidad downto 1 do
begin
for cont2:=1 to cont1 do
begin
if arreglo[cont1]>arreglo[cont2] then
begin
temp1:=arreglo[cont1];
temp2:=arreglo[cont2];
arreglo[cont1]:=temp2;
arreglo[cont2]:=temp1;
end;
end;
end;
writeln('El valor mayor es: ',arreglo[1]);
write('El valor menor es: ',arreglo[cantidad]);
ReadKey;
end.
CORRIDA DEL PROGRAMA.

3.- PROGRAMA
program ordenaformaacendente;
uses
crt;
type
vector=array [1..100] of integer;
var
arreglo:vector;
cantidad,cont1,cont2,temp1,temp2,numero:integer;
begin
ClrScr;
writeln('PROGRAMA QUE ORDENA DE MANERA ACENDENTE EL CONTENIDO DEL VECTOR.');
writeln;
Write('Cantidad de valores: ');Readln(cantidad);
writeln;
for cont1:=1 to cantidad do
begin
Write('Valor ',cont1,': ');Readln(arreglo[cont1]);
end;
writeln;
for cont1:=cantidad downto 1 do
begin
for cont2:=1 to cont1 do
begin
if arreglo[cont1]<arreglo[cont2] then
begin
temp1:=arreglo[cont1];
temp2:=arreglo[cont2];
arreglo[cont1]:=temp2;
arreglo[cont2]:=temp1;
end;
end;
end;
for cont1:=1 to cantidad do
begin
if cont1=cantidad then
begin
write(arreglo[cont1],'.');
end
else
begin
write(arreglo[cont1],', ');
end;
end;
ReadKey;
end.
CORRIDA DEL PROGRAMA.

4.- PROGRAMA
program repeticiones;
uses
crt;
type
vector=array [1..100] of integer;
var
arreglo:vector;
cantidad,cont1,cont2,temp1,temp2,numero,veces:integer;
begin
ClrScr;
writeln('PROGRAMA QUE MUESTRA CUANTAS VECES SE REPITEN LOS VALORES DE UN VEC.');
writeln;
Write('Cantidad de valores: ');Readln(cantidad);
writeln;
for cont1:=1 to cantidad do
begin
Write('Valor ',cont1,': ');Readln(arreglo[cont1]);
end;
writeln;
for cont1:=cantidad downto 1 do
begin
for cont2:=1 to cont1 do
end;
begin
write('Se repite ',cantidad,' veces el ,numero,.');
end;
ReadKey;
end.
CORRIDA DEL PROGRAMA.

5.- PROGRAMA
program invertirVALORES;
uses
crt;
type
vector=array [1..100] of integer;
var
arreglo:vector;
cantidad,cont1,cont2,temp1,temp2,numero:integer;
begin
ClrScr;
writeln('PROGRAMA QUE INVIERTE LOS VALORES.');
writeln;
Write('Cantidad de valores: ');Readln(cantidad);
writeln;
for cont1:=1 to cantidad do
begin
Write('Valor ',cont1,': ');Readln(arreglo[cont1]);
end;
writeln;
write('Valores originales: ');
for cont1:=1 to cantidad do
begin
if cont1=cantidad then
begin
write(arreglo[cont1],'.');
end
else
begin
write(arreglo[cont1],', ');
end;
end;
writeln;
write('Valor invertidos: ');
for cont1:=1 to cantidad do
begin
if cont1=cantidad then
begin
arreglo[cont1]:=arreglo[cont1]*-1;
write(arreglo[cont1],'.');
end
else
begin
arreglo[cont1]:=arreglo[cont1]*-1;
write(arreglo[cont1],', ');
end;
end;
ReadKey;
end.
CORRIDA DEL PROGRAMA.

6.- PROGRAMA
program nombresycuantoscaracterestienen;
uses
crt;
type
vector=array [1..100] of string;
var
arreglo:vector;
cont1,cantidad,letras:integer;
begin
ClrScr;
writeln('PROGRAMA QUE LEE NOMBRES Y TE DICE CUANTOS CARACTERES TIENE.');
writeln;
Write('Escribe la cantidad de nombres a escribir: ');Readln(cantidad);
for cont1:=1 to cantidad do
begin
Write('Nombre ',cont1,': ');Readln(arreglo[cont1]);
end;
Writeln;
for cont1:=1 to cantidad do
begin
letras:=length(arreglo[cont1]);
writeln(arreglo[cont1],': ',letras,' letras.');
end;
ReadKey;
end.
CORRIDA DEL PROGRAMA.

7.- PROGRAMA
program sumadedosvectores;
uses
crt;
type
vector=array [1..100] of integer;
var
arreglo1:vector;
arreglo2:vector;
long1,long2,cont,suma:integer;
begin
ClrScr;
writeln('PROGRAMA QUE SUMA DOS VETORES.');
writeln;
Write('Vector 1 (longitud): ');Readln(long1);
write('Vector 2 (longitud): ');Readln(long2);
writeln;
suma:=0;
writeln('Vector 1');
for cont:=1 to long1 do
begin
write('Valor ',cont,': ');Readln(arreglo1[cont]);
suma:=arreglo1[cont]+suma;
end;
writeln;
writeln('Vector 2');
for cont:=1 to long2 do
begin
write('Valor ',cont,': ');Readln(arreglo2[cont]);
suma:=arreglo2[cont]+suma
;
end;
writeln;
write('LA SUMA DE AMBOS VECTORES ES: ',suma);
ReadKey;
end.
CORRIDA DEL PROGRAMA.

8.- PROGRAMA
uses
crt;
type
vector=array [1..100] of longint;
var
arreglo:vector;
cantidad,cont1:integer;
sumatoria,suma:longint;
begin
ClrScr;
writeln('PROGRAMA QUE CALCULA LA SUMATORIA DE LOS ELEMENTOS DE UN VECTOR.');
writeln;
Write('Cantidad de valores: ');Readln(cantidad);
writeln;
suma:=0;
for cont1:=1 to cantidad do
begin
Write('Valor ',cont1,': ');Readln(arreglo[cont1]);
suma:=suma+arreglo[cont1];
end;
writeln;
writeln('Suma: ',suma);
sumatoria:=0;
for cont1:=1 to suma do
begin
sumatoria:=sumatoria+cont1;
end;
write('Sumatoria: ',sumatoria);
ReadKey;
end.
CORRIDA DEL PROGRAMA.

9.- PROGRAMA
uses
crt;
const
max=100;
type
vector=array [1..max] of real;
var
arreglo:vector;
alumnos,cont1,cont2,materias:integer;
temp,suma:real;
begin
ClrScr;
writeln('PROGRAMA QUE DADAS 10 CALIF. DE ALUMNOS MUESTRE EL PROMEDIO DEL GRUPO.');
writeln;
Write('Alumnos: ');Readln(alumnos);
Write('Asignaturas: ');Readln(materias);
Writeln;
delay(800);
for cont1:=1 to alumnos do
begin
writeln('Alumno ',cont1);
for cont2:=1 to materias do
begin
write('Calificacion ',cont2,': ');Readln(temp);
suma:=suma+temp;
end;{suma}
arreglo[cont1]:=suma/materias;{promedio insertado en el vector}
writeln;
end;{alumnos}
suma:=0;
for cont1:=1 to materias do
begin
suma:=arreglo[cont1]+suma;
end;
Write('Promedio grupal: ',suma/materias:0:2);
ReadKey;
end.
CORRIDA DEL PROGRAMA.

WEB MAY, 2004
LUIS ALBERTO JAIME PARRA (4-B)
N.L=16