Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int fixMyNumber3(int a){
- int x = a/100;
- int y = ((a%100)/10);
- int z = a%10;
- if(x<3&&y<3){
- return (x*200)+(y*20)+(z);
- }
- else if(x>3&&y<3&&z<3){
- return ((x-1)*100)+(y*20)+(z*2);
- }
- else if(x>3&&y<3&&z>3){
- return ((x-1)*100)+(y*20)+(z-1);
- }
- else if
- else if(x>3&&y>3&&z>3){
- return ((x-1)*100)+((y-1)*10)+(z-1);
- }
- return (x*100)+(y*10)+(z*1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement