```
class Solution {
public:
int gcd(int a, int b)
{
if(b == 0) return a;
else return gcd(b,a%b);
}
bool canMeasureWater(int x, int y, int z) {
if(x+y < z)
return false;
if (z == 0)
return true;
if(z%(gcd(x,y)) == 0)
return true;
return false;
}
};
```