You are on page 1of 20

TRABAJO ENCARGADO DE PROGRAMACIÓN PARA INGENIERIA

PROPUESTO 1:

PROPUESTO 2:

PROPUESTO 3:
PROPUESTO 4:
PROPUESTO 5:
PROPUESTO 6:
clear all;
clc;
f=1;
s=1;
n=input('ingrese n: ');
x=input('ingrese x: ');
for i=1:factorial(n)
f=f+i;
if rem(i,2)==0

s=s+x^i/f;
else
s=s-x^i/f;
end
end
fprintf('la sumatoria es: %.5f\n',s);

PROPUESTO 7:

clear all; clc;


f=0;
Datos=inputdlg({'n','m'},'unaj');
datos=str2double(Datos);
n=datos(1,1);
m=datos(2,1);
for j=17:1:n
f=f+m;
end
g=strcat(['el resultado es',num2str(f)]);
msgbox(g,'hadal')
for i=15:1:m
f=f+n;
end
g=strcat(['el resultado es',num2str(f)]);
msgbox(g,'hadal')
PROPUESTO 8:
clear all; clc;
f=0;
for j=2:5:1800
f=f+1800;
end
g=strcat(['el resultado es',num2str(f)]);
msgbox(g,'hadal')
for i=5:5:1800
f=f+1800;
end
g=strcat(['el resultado es',num2str(f)]);
msgbox(g,'hadal')
PROPUESTO 9:
clear all;
clc;
a=inputdlg('n: ','unaj');
a=str2double(a);
n=a(1,1);
while n>1
if rem(n,2)==0
n=n/2;
g=strcat(['el resultado',num2str(n)]);
msgbox(g,'hadal')
else
n=3*n+1;
g=strcat(['el resultado ',num2str(n)]);
msgbox(g,'hadal')
end
end
PROPUESTO 10:
TEMPERATURA MEDIDOS EN CADA DOS HORAS:
TEMPERATURAS MEDIDAS EN CADA HORA
CON INPUTDLG

PROPUESTO 11:
PROPUESTO 12:

PROPUESTO 13:
PROPUESTO 14:
PROPUESTO 15:

PROPUESTO 16:
PROPUESTO 17:

PROPUESTO 18:
PROPUESTO 19:

PROPUESTO 20:
PROPUESTO 21:
clear all;
clc;
s=0;
k=1;
term=1;
p=1;
while abs(term)>1e-5
s=s+term;
k=k+1;
p=-p;
term=p/k^2;
end
nterm=k;
sum=s;
sumexacta=pi^2/12;
diff=sum-sumexacta
PROPUESTO 22:
PROPUESTO 23:
 Maximo comun divisor
clear all;
clc;
n1=input('n: ');
n2=input('m: ');
n3=input('p: ');
d=2;
mcd=1;
while d<=n1 & d<=n2 & d<=n3
if rem(n1,d)==0 & rem(n2,d)==0 & rem(n3,d)==0
mcd=mcd*d;
n1=n1/d;
n2=n2/d;
n3=n3/d;
else
d=d+1;
end
end
fprintf('el m.c.d. es: %d',mcd);
 Minimo común multiplo
clear all;
clc;
n1=input('n: ');
n2=input('m: ');
n3=input('p: ');
d=2;
mcm=1;
while n1~=1 | n2~=1 | n3~=1
if rem(n1,d)==0 | rem(n2,d)==0 |rem(n3,d)==0
mcm=mcm*d
if rem(n1,d)==0
n1=n1/d;
end
if rem(n2,d)==0
n2=n2/d;
end
if rem(n3,d)==0
n3=n3/d;
end
else
d=d+1;
end
end
PROPUESTO 24:
PROPUESTO 25:
clear all;
clc;
b=input('ingrse numero n: ');
x=b;
n=0;
p=1;
while x>=2 && x<=9
r=rem(x,10);
b=b*r*p;
p=p*2;
x=fix(x/10);
end
fprintf('el numero en base 10 es: %d',b)
PROPUESTO 26:
clear all;
clc;
b=input('ingrse numero n: ');
m=input('ingrse numero m: ');
x=b;
n=0;
p=1;
while x>0
r=rem(x,m);
n=n*r*p;
p=p*2;
x=fix(x/m);
end
fprintf('el numero en base es: %d',b)
PROPUESTO 27:
clear all;
clc;
x=1;
y=1;
a=0;
b=0;
es=true;
while a==0
while b==0
if not(x-y==1)
z=mod(x,x-y);
if z==0
es=false;
b=1;
end
y=y+1;
if x-y<=0
b=1
end
else
b=1;
end
end
if es
x
end
x=x+1;
b=0;
y=1;
es=true;
end

PROPUESTO 28:
clear all;
clc;
p=0;
s=2;
datos=inputdlg({'a'},'unaj');
datos=str2double(datos);
a=datos(1,1);
for x=1:a
a=false
while(~a)
m=2
band=true
while(band & (m<s))
if(mod(s,m)==0)
band=falso
else
m=m+1
end
end
if(band)
p=p+1
fprintf('el primo numero %d es %d',p,s)
end
s=s+1
end
end

PROPUESTO 29:
PROPUESTO 30:
clear all;
clc;
n=input('ingrese numero:');
s=0;
for i=1:n-1
if rem(n,i)==0
s=s+i;
end
end
if n==s
disp('es perfecto');
else
disp('no es perfecto');
end

You might also like