GCD & LCM of 2 numbers MATLAB & JAVA
2.7 هزار بار بازدید -
5 سال پیش
-
In my this video I
In my this video I have explained the concept of G.C.D & L.C.M in detail & shown the simulation in MATLAB & JAVA.
MATLAB code:
x=input('Enter the first number');
y=input('Enter the second number:');
for i=1:x
if(rem(x,i)==0 && rem(y,i)==0)
c=i;
end
end
z=(x*y)/c;
disp('GCD=');
disp(c);
disp('LCM=');
disp(z);
MATLAB code:
x=input('Enter the first number');
y=input('Enter the second number:');
for i=1:x
if(rem(x,i)==0 && rem(y,i)==0)
c=i;
end
end
z=(x*y)/c;
disp('GCD=');
disp(c);
disp('LCM=');
disp(z);
5 سال پیش
در تاریخ 1398/03/06 منتشر شده
است.
2,714
بـار بازدید شده