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

 

gaurav.gupta@mq.edu.au variables > distance
prev  |  next  |  chance

Define a function that when passed the locations of two points (x1, y1) and (x2, y2), returns the distance between them.


distance(10, 5, 7, 4) → 3.1622776601683795
distance(5, 8, -1, 20) → 13.416407864998739
distance(10, 0, 10, 20) → 20.0

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

double distance(int x1, int y1, int x2, int y2) { }

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: 2 Post-solution available

Copyright Nick Parlante 2017 - privacy