0
Hey can you help me by correcting the code?
import java.util.scanner; class euclidean distance { public static void main(String[] args) { int x1,x2,y1,y2; system.out.println("enter x,y values of first point"); scanner sc = new scanner(system.in); x1=sc.nextint(); y1=sc.nextint(); system.out.println("enter x,y values of sec point"); scanner sc = new scanner(system.in); x2=sc.nextint(); y2=sc.nextint(); system.out.println("dist is "+ Math.sqrt ((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))""); } }
4 Réponses
+ 1
Thank u
0
I think you should learn Java
https://www.sololearn.com/Course/Java/?ref=app
https://code.sololearn.com/cZBpB3bpu7Rt/?ref=app
0
Use Scanner sc=new Scanner(System.in); only once
You have not followed to make which letter in uppercase and which letter in lower case.
You have not imported math package that is:
import java.util.Math;
Take input x1,x2,y1,y2 in the same line at once.
There are many small mistakes.like:-import.java.util.Scanner;
You have not maintained case sensitivity of java.
0
First complete a Java Tutorial please. Your code corrected looks i.e. like:
https://code.sololearn.com/cQsYmxH6Lx2u/?ref=app