package nambers;
import java.util.Scanner;
public class nambers {
public static void main(String[] args){
for(int i=0; i!=-1; i++){
Scanner scan=new Scanner(System.in);
System.out.println("enter number m");
double m=scan.nextDouble();
System.out.println("enter number n");
double n=scan.nextDouble();
if (Math.abs(n-10)>Math.abs(m-10)){
System.out.println(m+ " is closer to 10");
}
else {
System.out.println(n+ " is closer to 10");
}
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.