summaryrefslogtreecommitdiff
path: root/1553/CH2/EX2.18/2Ex18.sce
blob: 7d19d2f521a425410f6a7ebb5f49b5ef5ca49703 (plain)
1
2
3
4
5
6
7
8
9
10
11
//chapter 2 Ex 18
clc;
clear;
close;
n1=16; n2=24; n3=36; n4=54;
n=lcm(int32([n1,n2,n3,n4]));
Lcm=double(n);
small=10000; //smallest 5 digit number
remainder=pmodulo(small,Lcm);
smallest_num=small+n-remainder;
mprintf("The smallest such number is %d",smallest_num);