0

Hello, I need some help please..

I need to write a recursive predicate in Prolog that subtracts two numbers until number 2 is higher than the result.

I have completed the logic in C++:

```
#include <iostream>
using namespace std;
int mod3(int a, int b)
{
int intResult = a-b;
if(intResult > b)
{
return mod3(intResult, b);
}
return intResult;
}
int main(int argc, char *argv[]) {
cout << mod3(23, 5);
return 0;
}
```

BUT putting it into Prolog is doing my brain in.. This is what I've got so far:

```
modulo(X, M, Y) :-
Y is (X-M),
(Y > M),
modulo(X, M, Y).
```

Could someone give me some help/pointers on what I'm doing wrong?

Thanks :)