1 solutions

  • 0
    @ 2025-11-5 15:45:27

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    long long a,b,t;
    int main()
    {
    	cin>>a>>b;
    	t=max(a,b);
    	while(t%min(a,b)!=0)
    	    t+=max(a,b);
    	cout<<t;
    	
    	return 0;
    }
    

    Pascal :

    var
      a,b,s,c,n,m,r:longint;
    begin
      readln(m,n);
      a:=m;
     
      b:=n;
     
      repeat
     
      r:=a mod b;
     
      a:=b;
     
      b:=r;
     
      until r=0;
     
      s:=n*m div a;
     
      writeln(s);
    end.
    
    • 1

    Information

    ID
    17132
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By