lunes, 5 de noviembre de 2012

Practica 8


PRACTICA 8

TREJO AVALOS NESTOR JOAQUIN
BARRON JUAN CARLOS


PROBLEMA 1

INICIO
a=2005, t int
población real
Print, año        poblacion mundial"
for (t=5 to 20 step t=t+1)
{
poblacion = 6.0*exp(0.02+t)
Print, a, "  ", poblacion
a = a+1;
}
FIN


PROBLEMA 2

INICIO
g=0.0,li=0.0,a=0.0 real
i=0 int
for(i=1 to 10 step i+1)
{
Print, "Introduce la cantidad de galones"
Read, g
li=g*3.785
Print,  g, " galones=", li, " litros\n"
}
FIN




PROBLEMA 3

INICIO
{
g=0.0,li=0.0,a=0.0 real
i=0 int
Print  "Cuantos galones desea convertir?"
Read a
for(i=1 to a step i+1)
{
Print, “Introduce la cantidad de galones"
Read g
li=g*3.785
Print, g, " galones=", li, " litros\n";
}
FIN



PROBLEMA 4

INICIO
i=0,a,num,pos=0,neg int
Print, "cuantos numeros introduciras?"
Read a
for(i=1 to a step i+1)
{
Print “Introduce numero positivo o negativo"
Read num
if(num==0)
{
Print, "Valor nulo, introducir de nuevo el valor\n"
i=i-1
}
else if(num>0)
{
pos=num+pos
}
else if(num<0)
{
neg=num+neg
}
}
Print, "Suma de positivos=", pos, "\n"

Print, "Suma de negativos=", neg
FIN



PROBLEMA 5

INICIO
c, n=0, p=0 int
usenum, totpos=0,totneg=0 real
for(c=1 to 5 step c+1)
{
Print, "Introduce un numero (positivo o negativo)"
Read usenum
if(usenum<0)
{
 totneg=totneg+usenum
 n=n+1
 } 
 else 
 {
 if(usenum>0)
{  
totpos=totpos+usenum
p=p+1
}
}
}
Print "El total positivo es: ", totpos
Print "El total negativos es: ", totneg
Print "El promedio positivo es: ", totpos
Print, "El promedio negativos es: "totneg
FIN



PROBLEMA 6

INICIO
 x, y real
Print setiosflags(ios::fixed)
Print setiosflags(ios::showpoint)
Print, setprecision(6)
Print,  "a)\n"
Print, "valor de x     valor de y"
Print, "----------     -----------"
for(x=5 to 10 step x=x+0.2)
{
y=3*pow(x,5)-2*pow(x,3)+x
Print, setw(7) x
Print, setw(20)y
}
Print, "\n\nb)"
Print, "valor de x       valor de y"
Print, "---------        ----------"
for(x=1 to 3 step x=x+0.1)
{
y=1+x+pow(x,2)/2+pow(x,3)/6+pow(x,4)/24
Print, setw(7)x
Print, setw(20)y
}
Print, "\n\nc"
print, "valor de t          valor de y"
print,"----------          ----------"
for(x=4 to 10 step  x=x+0.2)
{
y=2*exp(0.8*x)
print, setw(7)x
print, setw(20)y
}
FIN



PROBLEMA 7

INICIO
 A=2005, T int
población real
print, "Año      Poblacion mundial"
for (T=5 to12 step T=T+1)
{
poblacion = 6.0*exp(0.02+T)
print A, "\t", poblacion
A = A+1
}
FIN



PROBLEMA 8

INICIO
x, y, v=350.0 real
ang = 32.5*3.1416/180.0 real
t real
print "x              y"
for(t=0 to 20 step t=t+0.5)
{
x = v*t*cos(ang)
y = v*t*sin(ang)
print  x, "         ",y,
}
FIN



PROBLEMA 9

INICIO
a=1, conta, n=20 int
r=0.5real
suma=0.0 real
termino=0.0 real
 for (conta=1 to n step conta=conta+1)
{
termino= a*pow(r,(conta-1))
print, termino, " "
if (conta==20)
{
Print "="
}
else
print,  " + "
suma=suma+termino
}
Print, suma
FIN



PROBLEMA 10

INICIO
media_armo,mediag,prod=1.0,suma=0.0 real
x=1 real
n=0,conta=1 int
for ( conta=1to x!=999  step conta=conta+1)
{
Print, "introduce valor numerico = "
Read, x
if(x!=999)
{
prod=prod*x
suma=suma+(1.0)/x
}
}
mediag=sqrt(prod)
media_armo=(conta-1)/suma
print, "media geometrica = “mediag
print, "media arcominca = "media_armo
FIN



No hay comentarios:

Publicar un comentario