troubleshooting Question

maxMod5 challenge

Avatar of gudii9
gudii9Flag for United States of America asked on
Java EEJavaProgramming Languages-OtherProgramming
25 Comments1 Solution219 ViewsLast Modified:

I am working on below challenge

I tried my code as below
public int maxMod5(int a, int b) {
  return a;
 if( (a==b)){
 return 0;
 else if( (b%5==a%5)){
 return 0;
 return 1;

Open in new window

I am getting below result
Expected      Run            
maxMod5(2, 3) → 3      1      X         
maxMod5(6, 2) → 6      6      OK         
maxMod5(3, 2) → 3      3      OK         
maxMod5(8, 12) → 12      1      X         
maxMod5(7, 12) → 7      0      X         
maxMod5(11, 6) → 6      11      X         
maxMod5(2, 7) → 2      0      X         
maxMod5(7, 7) → 0      0      OK         
maxMod5(9, 1) → 9      9      OK         
maxMod5(9, 14) → 9      0      X         
maxMod5(1, 2) → 2      1      X         
other tests

how to  improve my approach, results and design of this challenge. How do i make a graphical venn or flow chart or some other relevant diagram to design it before writing code to decide best strategy?
 Please advise

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 25 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 25 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004