Advertisement
Guest User

Untitled

a guest
Sep 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public int fixMyNumber3(int a){
  2. int x = a/100;
  3. int y = ((a%100)/10);
  4. int z = a%10;
  5.  
  6. if(x<3&&y<3){
  7. return (x*200)+(y*20)+(z);
  8. }
  9. else if(x>3&&y<3&&z<3){
  10. return ((x-1)*100)+(y*20)+(z*2);
  11. }
  12. else if(x>3&&y<3&&z>3){
  13. return ((x-1)*100)+(y*20)+(z-1);
  14. }
  15. else if
  16. else if(x>3&&y>3&&z>3){
  17. return ((x-1)*100)+((y-1)*10)+(z-1);
  18. }
  19. return (x*100)+(y*10)+(z*1);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement