id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

Warmup-1 > close10
prev  |  next  |  chance

Given 2 int values, return whichever value is nearest to the value 10, or return 0 in the event of a tie. Note that Math.abs(n) returns the absolute value of a number.


close10(8, 13) → 8
close10(13, 8) → 8
close10(13, 7) → 0

...Save, Compile, Run (ctrl-enter)

public int close10(int a, int b) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 172.0

Copyright Nick Parlante 2017 - privacy