viernes, 9 de noviembre de 2012

Practica 10

Problema 1.

Inicio
valores[8] int
 I int
Suma int
Promedio int
for( I=0  I to 8 step  I= I+1)
{
Print "Introduce Valores ["<<I<<"]:"
 Read valores[I]
}
suma=0
for(I=0  I  to 8  step  I= I+1)
{A
suma=suma+valores[I]
}
promedio=suma/8
print “El Promedio es: ",promedio
print “Valores Mayor o Igual al Promedio: "
for(I=0   I    to  7 I= I+1)
{
if(valores[I]>=promedio)
{
Print valores [I]
}
}
Fin


Problema 2 a).

Inicio
primero [10] int
segundo [10] int
tercero [10] int
I int
for(i=0   I  to   10  step  i= i+1)
{
Print "primero ["<<i<<"]:"
Read primero[i]
print "segundo["<<i<<"]:"
read segundo[i]
}
Print "primero+segundo=tercero"
Print "_______________________"
for(i=0   I   to  10 step i= i+1)
{
Print ""

tercero[i]=primero[i]+segundo[i]
print   primero[i], "\t", segundo[i] ,"\t", tercero[i]
}
Fin

Problema 2 b).

Inicio
primero [10] int
segundo [10] int
tercero [10] int
I int
for(i=0   I  to  10 step  i= i+1)
{
Print primero ["<<i<<"]:"
Read primero[i]
Print segundo["<<i<<"]:"
 Read segundo[i]
}
Print primero*segundo=tercero"
Print "_______________________"
for(i=0   I  to  10  step  i= i+1)
{
tercero[i]=primero[i]*segundo[i]
print primero[i],"\t",segundo[i],"\t",tercero[i]
}
Final


Problema 3 a).

Inicio
valores [10] real
desv [10] real
total=0.0 real
promedio real
I int
for(i=0    I   to  10  step   i= i+1)
{
Print "valores ["<<i<<"]:"
Read valores[i]
total=total+valores[i]
}
promedio=total/10
for(i=0  I  to  10 step i= i+1)
{
desv[i]=valores[i]-promedio

}
Print "desviacion          valores"
for(i=0  I  to  10 step  i= i+1)
{
Print desv[i], "\t\t\t",valores[i]
}
Final.

Problema 3 b).

Inicio
valores [10] float
desv [10] float
total=0.0 float
promedio float
varianza float
suma=0.0 float
I int
for(i=0  I  to  10  step  i= i+1)
{
Print "valores ["<<i<<"]:"
Read valores[i]
total=total+valores[i]
}
promedio=total/10
for(i=0  I  to  10 step i= i+1)
{
desv[i]=valores[i]-promedio

}
Print "desviacion          valores"
for(i=0;i<10;i++)
{
Print desv[i],"\t\t\t",valores[i]
}
for(i=0 I  to  =9 step i= i+1)
{
suma=suma+pow(desv[i],2)
}
varianza=suma /10
print "la varianza es",varianza
Fin

Problema 3 c).

Inicio valores[10], desv[10], total=0.0, prom, min=0, max=0, inter=0, a=0, b=0 real
 i int
for(i=0;i<10;i++)
{
print"Valores[",i,"],",
read valores[i]
total=total+valores[i]
}
prom=total/10;
for(i=0;i<10;i++)
{
desv[i]=valores[i]-prom;
}
print,"Desviacion \t Valores",
for(i=0;i<10;i++)
{
print,  ",desv[i],"\t            ",valores[i],
}
print,"\n"
print,"Intervalo Minimo",
for(i=0;i<10;i++)
{
if(desv[i]<=min)
{
print,desv[i]
a=a+desv[i];
}
}
print,"\n",
print,"Minimo",
print,a,
print,"\n",
print,"Intervalo Maximo"
for(i=0;i<10;i++)
{
if(desv[i]>=max)
{
print,desv[i],
b=b+desv[i];
}
}
print,"\n",
print,"Maximo"
print,b,
print,"\n",
inter=b-a;
print"Intervalo= Maximo-Minimo= ",
Print,inter,
Fin.


No hay comentarios:

Publicar un comentario