Академический Документы
Профессиональный Документы
Культура Документы
clc
n=input('ingrese un numero:');
if n==0;
'el numero no tiene signo'
else
if n>0;
'el numero es positivo'
else
'el numero es negativo'
end
end
CORRIENDO PROGRAMA:
ingrese un numero:-2
ans =
el numero es negativo
clc
n=input('ingrese un numero:')
if n==0;
else
if rem(n,2)==0;
else
end
CORRIENDO PROGRAMA:
ingrese un numero:15
n=
15
ans =
Coste=((100-20)/100)* Coste;
end
CORRIENDO PROGRAMA:
Coste =
250
descuento=((100-20)/100)*Coste;
disp([descuento])
end
CORRIENDO PROGRAMA:
Coste =
100
CORRIENDO PROGRAMA:
n=
10
Coste =
250
ans =
200
n=input('ingrese un numero:')
if n<0
end
if n>14
end
if n==7;
'es neutro'
else
if n>7
'n es basico'
else
'n es acido'
end
end
CORRIENDO PROGRAMA:
ingrese un numero:14
n=
14
ans =
n es básico
CORRIENDO PROGRAMA:
ingrese un numero:16
n=
16
ans =
no tiene respuesta
n=
ans =
n es acido
CORRIENDO PROGRAMA:
ingrese un numero:7
n=
ans =
es neutro
6. %Programa Para Contar Los Números De 1 Al 10
clc
for n=1:10;
disp([n])
end
CORRIENDO PROGRAMA:
10
disp([n3 n2 n1])
end
disp([n2 n3 n1])
end
disp([n3 n1 n2])
end
disp([n1 n3 n2])
end
disp([n2 n1 n3])
end
disp([n1 n2 n3])
end
else
end
CORRIENDO PROGRAMA:
-456 -8 9
CORRIENDO PROGRAMA:
-7 -7 7
clc
disp('PROGRAMA PARA CALCULAR EL ESPACIO EN MRUV')
disp('-----------------------------------------------------------')
if t<0
end
e=vo*t+(1/2)*a*(t^2);
disp('----------------------------------------------------------')
disp(' vo t a e')
fprintf('%5.0f\t',vo);
fprintf('%5.0f\t',t);
fprintf('%5.0f\t',a);
fprintf('%5.0f\n',e);
disp('----------------------------------------------------------')
CORRIENDO PROGRAMA:
-----------------------------------------------------------
ingrese el tiempo(s) t: 10
ingrese la aceleración(m/s^2) a: 6
----------------------------------------------------------
vo t a e
14 10 6 440
----------------------------------------------------------
end%finalizando el programa
end
CORRIENDO PROGRAMA:
ingresa un numero:-5
ans =
el numero es IMPAR
clc,clear all
'aprobado'
'desaprobado'
end
CORRIENDO PROGRAMA:
ingresa un numero:12
ingresa un numero:14
ingresa un numero:12
suma =
38
pro =
12.6667
ans =
aprobado
else%caso contrario
end
end%finalizando el programa
CORRIENDO PROGRAMA:
el numero es:14
ans =
no es multiplo de 4
CORRIENDO PROGRAMA:
el numero es:12
ans =
es multiplo de 4
k=10*c+d
else%caso contrario
end
end%finaliza el programa
CORRIENDO PROGRAMA:
x=
2478
k=
78
y=
2500
13. %Programa Para Calcular El Menor De Tres Numeros Ingresados:
clc,clear all
menor=a%resultaria el digito a
else%caso contrario
menor=c%resultaria el digito c
else%caso contrario
menor=b%resultaria el digito b
else%caso contrario
menor=c%resultaria el digito c
end%finalizando el programa
CORRIENDO PROGRAMA:
ingrese un numero:157
ingrese un numero:45
ingrese un numero:78
menor =
45
disp([te]);
else%caso contrario
disp('ingrese valores positivos');%siginifica que este comentario saldra si en caso que digitemos numeros
negativos
end%finalizando el programa
CORRIENDO PROGRAMA:
6.2893
end%finalizando el programa
end
CORRIENDO PROGRAMA:
ingresa un numero:12
ans =
el numero es PAR
CORRIENDO PROGRAMA:
ingresa un numero:15
ans =
el numero es IMPAR
clc,clear all
n=input('ingrese el numero:');
for i=n-5:n+5;
disp(i)
end
CORRIENDO PROGRAMA:
ingrese el numero:6
10
11
n=input('ingrese un numero:');
for x=1:n;
k=x+273;
f=1.8.*x+32;
r=f+460;
disp([x k f r])
end
CORRIENDO PROGRAMA:
ingrese un numero:14
5 278 41 501
10 283 50 510
clc,clear all
n=input('ingrese un numero:');
for i=n:n+1;
disp([n n+1])
end
CORRIENDO PROGRAMA:
ingrese un numero:12
12 13
12 13
clc,clear all
n=input('ingrese un numero:');
for i=n:n+12;
s=i-n;
disp([i n s])
end
CORRIENDO PROGRAMA:
ingrese un numero:5
n:n+12 n resta
5 5 0
6 5 1
7 5 2
8 5 3
9 5 4
10 5 5
11 5 6
12 5 7
13 5 8
14 5 9
15 5 10
16 5 11
5. % Programa
clc,clear all
n=input('ingrese el numero:');
for i=1:n;
s=i/n;
disp([i n s])
end
CORRIENDO PROGRAMA:
ingrese el numero:9
6. Programa
clc,clear all
n=input('ingrese el numero:');
for i=1:n;
s=i/n;
disp([i n s])
end
CORRIENDO PROGRAMA:
ingrese el numero:8
8 8 1
7. Programa:
clc,clear all
n=input('ingrese el numero:');
for r=1:12;
D=n*r;
s=D./n;
disp([D n s])
end
CORRIENDO PROGRAMA:
ingrese el numero:15
15 15 1
30 15 2
45 15 3
60 15 4
75 15 5
90 15 6
105 15 7
120 15 8
135 15 9
150 15 10
165 15 11
180 15 12
clc,clear all
n=input('ingrese el numero:');
while n<=1
n=input('ingrese el numero:');
end
D=n;
sum=0;
for d=1:n;
resto=rem(D,d);
if resto==0
sum=sum+d;
disp([d])
end
end
CORRIENDO PROGRAMA:
ingrese el numero:12
12
clc,clear all
n=input('ingrese el numero:');
fa=1;
while n<0;
n=input('ingrese el numero:');
end
if n==0;
Factorial=fa
else
for i=1:n;
fa=fa*i;
if i==n;
Factorial=fa
end
end
end
CORRIENDO PROGRAMA:
ingrese el numero:5
Factorial =
120
clc,clear all
while n<=1
end
sum=0-n;
for d=1:n
r=mod(n,d);
if r==0
sum=sum+d;
end
end
disp([sum])
if sum==n
else
end
CORRIENDO PROGRAMA:
el numero no es perfecto
clc,clear all
n=input('ingrese un numero:');
d=n-5;
for n=d:n+5;
kelvin=n+273;
disp([n kelvin])
end
CORRIENDO PROGRAMA:
ingrese un numero:7
2 275
3 276
4 277
5 278
6 279
7 280
8 281
9 282
10 283
11 284
12 285
12.-
clc; clear memory
N=input('ingrese una nota: ')
if N>= 10.5
disp('aprobado')
else
disp('desaprobado')
end
ingrese una nota: 10
N=
10
desaprobado
N=
-5
>> Untitled
ingrese numero: 2
N=
>> Untitled
ingrese numero: 0
N=
el numero es cero