Sie sind auf Seite 1von 3

EJERCICIO 1

clc
clear
contador=0;
for k=25:-1:1;
contador=contador+1;
m(contador)=k^3;
end
display(m)

EJERCICIO 3

clc
clear
t=0;
for k=1:30;
t=t+k*(2^(k-1))
end
t

EJERCICIO 5

clc
clear
for r=1:5
for s=1:8
if rem(r,2)~=0;
B(r,s)=r+2*s
elseif rem(r,2)==0;
B(r,s)=(r+s)^2
end
end
end
B

EJERCICIO 6

clc
clear
a=input('Introducir Primer Número= ')
b=input('Introducir Segundo Número= ')
c=input('Introducir tercer Número= ')
d=input('Introducir Cuarto Número= ')
e=input('Introducir Quinto Número= ')
f=input('Introducir Sexto Número= ')
g=input('Introducir Séptimo Número= ')
h=input('Introducir Octavo Número= ')
i=input('Introducir Noveno Número= ')
j=input('Introducir Décimo Número= ')
U=[a b c d e f h i j]
promedio=mean(U)
maximo_valor=max(U)
minimo_valor=min(U)
EJERCICIO 7

clc
clear
suma=0
for k=1:2:29;
suma=suma+k*(k+2)
end

EJERCICIO 8

clc
clear
a=input('Introducir Primer Número= ')
b=input('Introducir Segundo Número= ')
c=input('Introducir tercer Número= ')
d=input('Introducir Cuarto Número= ')
e=input('Introducir Quinto Número= ')
f=input('Introducir Sexto Número= ')
g=input('Introducir Séptimo Número= ')
h=input('Introducir Octavo Número= ')
i=input('Introducir Noveno Número= ')
j=input('Introducir Décimo Número= ')
U=[a b c d e f h i j]
Ascendente=sort(U)

EJERCICIO 9

clear
clc
N1=input('Nota 1= ')
P1=input('Peso de la nota 1= ')
N2=input('Nota 2= ')
P2=input('Peso de la nota 2= ')
N3=input('Nota 3= ')
P3=input('Peso de la nota 3= ')
N4=input('Nota 4= ')
P4=input('Peso de la nota 4= ')
N5=input('Nota 5= ')
P5=input('Peso de la nota 5= ')
if [N1 N2 N3 N4 N5]<=20&[P1 P2 P3 P4 P5]<1
A=[N1 N2 N3 N4 N5];
P=[P1 P2 P3 P4 P5];
v=A.*P;
m=sum(v);
s=sum(P);
promedio=m/s
elseif [N1 N2 N3 N4 N5]>20&[P1 P2 P3 P4 P5]>=1
disp('ERROR: Peso o Nota excesivo')
end
EJERCICIO 10

clc
clear
A0=input('Introdusca coeficientes= ');
x0=input('Introdusca un valor a evaluar= ');
A=[A0]
polyval(A0,x0)

EJERCICIO 11

clc
clear
u=50:120;
v=isprime(u);
w=find(v);
wp=u(w)

EJERCICIO 12

clear
clc
contador=0
for c=1:9
for d=0:9
for u=0:9
if c*100+d*10+u==u*100+d*10+c;
contador=contador+1;
v(contador)=u*100+d*10+c;
end
end
end
end
disp(contador)
disp(v)

Das könnte Ihnen auch gefallen