1 solutions

  • 0
    @ 2025-11-5 19:42:10

    C++ :

    #include<iostream>
    #include<cstdlib>
    using namespace std;
    int main()
    {
    	long long m,n,t;
    	cin>>m>>n;
    	long long a=m,b=n;
    	int r=m%n;
    	while(r!=0)
    	{
    	  m=n;
    	  n=r;
    	  r=m%n;
    	}
    	t=(a*b)/n;
    	cout<<t;
    
    	//system("pause");
    	return 0;
    }
    

    Pascal :

    
    var
      m,c,a,b,gbs,t:longint;
    begin
     read(a,b);
    t:=a*b;
     if (a>0) and (b>0) then 
       begin
        repeat
       c:=a mod b;
       a:=b;
       b:=c;
       until b=0;
         gbs:=t div a;
         
          writeln(gbs);
          end;
    end.
    
    • 1

    Information

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