194132025-12-08 18:00:23KristófA sárkány feladványa (50)cpp17Compilation error
#include <iostream>
#include <string>
using namespace std;

gcd(int a,int b)
{
if(a<b)swap(a,b);
while(b!=0)
    {
    int temp=b;
    b=a%b;
    a=temp;
    }
return a;
}

void print(string a,int l)
{
if(a.size()>l)
    {
    cout<<-1<<endl;
    return;
    }
while(a.size()<l)
    {
    a+="0";
    }
cout<<a<<endl;
}

void solve()
{
int n,m,l;
cin>>n>>m>>l;
long long nm=n*m;
print(to_string(nm/gcd(n,m)),l);
}



int main()
{
    int t;
    t=3;
    while(t--)
        {
        solve();
        }
    return 0;
}
Compilation error
open /var/local/lib/isolate/404/box/a.out: no such file or directory
main.cpp:5:1: error: ISO C++ forbids declaration of 'gcd' with no type [-fpermissive]
    5 | gcd(int a,int b)
      | ^~~