Write an algorithm that takes three integers and returns the smallest integer that is a multiple of all three integers.

//author Abdullahjan
#include<iostream>
using namespace std;
int main(){

int i,min,a[0];
int arr[3];

for(int i=0; i<3; i++){
cin>>arr[i];
}

min = arr[0];


for(int i = 0; i<3 ; i++)
{
if(arr[i]<min)
min = arr[i];
}


cout<<"the minmum value is "<<min<<endl;

for(int i = 1; i<3 ; i++)
{
if(arr[i]%min == 0)
cout<<"multiple of "<<endl;
else
cout<<"not multiple"<<endl;
break;

}
}
You are being asked to compute the Least Common Multiple.
https://www.mathsisfun.com/least-common-multiple.html

If it helps, the LCM is not necessarily one of the integers given you as input — it might be larger than any of them.
Topic archived. No new replies allowed.