c++ variables – I tried to compile this program manually but it does't seem [closed]

The code isnt compiling because you write things were you shouldnt like you tried to declare a method inside a method, it can be done but is not that way, so the problem is that you declared methods inside other methods

And others errors like tried to use modulus as mod while it is a%b

More or like it will be like that:

int g = 0;

int fun1(int a, int b)
{
    int m = a % b;
    return m;
}

int ggT(int a, int b)
{
    g += a;
    if (b == 0)
        return a;
    else
        return  ggT(b, a%b);
}

int main()
{
    int a = 7;
    int b = 14;
    int g = ggT(b, a);
    b = g;
    a = g;
}

It is fixed of errors but i dont know if it is what you want to do or get the answer you want

At final, b and a get g value, wich it is 7, so it is a maximun comun divisor algorithm? Looks like

Leave a Comment