Hello, I have a problem in hand, try to make a code in Haskell with the following conditions:
We introduce two numbers a y b
to be divided a/b
of type Integer
, so that we take your module and your coscious one
With the following restrictions you can only use sums, subtractions and comparators you can not use neither div
, nor mod
, or anything
// Edited from here
cocienteYResto:: Integer -> Integer -> (Integer, Integer)
cocienteYResto x y
| x < y = (x,?????)
| otherwise = ((cocienteYResto (x - y) y))
well here as we see when x< y
I'm returning the rest, but I have no way, well rather I do not know how to get that cosciente (this right now or observe that is divided between 0
, or that x<y
in a base case
You just have to split things like 3/2 10/4, but nothing of 3/8.
Suggestions of all kinds are accepted, I am starting and all help is good.
Greetings and thanks