We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Fundamentals
- Restaurant
- Discussions
Restaurant
Restaurant
Sort by
recency
|
258 Discussions
|
Please Login in order to post a comment
Can Someone Find the Error in my Function
int restaurant(int l, int b) { if(0 == b % l ) { return b/l; } else { float frac = (float)b / (float)l ; int i = 1; while( (frac != (int)(frac)) ) { frac +=(float)b / (float)l; i++; } return (int)(i)*(int)(frac); } }
My code in Java 15:
Easy one in C++, just using the GCD: