1 solutions

  • 0
    @ 2025-11-5 20:08:26

    C++ :

    #include <iostream>
    using namespace std;
    int gcd(int a,int b)
    {
    	if(a%b==0)return b;
    	return gcd(b,a%b);
    }
    int main()
    {
        int n,m;
        cin>>n>>m;
        cout<<n*m/gcd(n,m);
        
        return 0;
    }
    

    Pascal :

    var     m,n,i:longint;
    begin
      read(m,n);
      for i:=1 to n do
        if (i*m) mod n =0 then begin
                                 writeln(i*m);
                                 break;
                               end;
    end.
    
    • 1

    Information

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