What is the output of the following code?
import java.lang. Math. *;
class Main
public static void main(String args[])
System.out.println(Math.round(-7.5));
System.out.println(Math.abs(-7.5));
System.out.println(Math.ceil(-7.5)); System.out.println(Math.floor(-7.5));
}
}
Correct code:
import java.lang. Math. *;
class Main{
public static void main(String args[]){
System.out.println(Math.round(-7.5));
System.out.println(Math.abs(-7.5));
System.out.println(Math.ceil(-7.5)); System.out.println(Math.floor(-7.5));
}
}
Output:
-7
7.5
-7.0
-8.0
Comments
Leave a comment