class Output { public static void main(String args[]) { int x = 3.14; int y = (int) Math.abs(x); System.out.print(y); } }
Answers
Answered by
2
Question :-
int x = 3.14
int y = (int) Math.abs(x);
System.out.print(y);
Answer :-
Here, we are converting a double data type to integer data type.
So, when converting to an integer, the value after the decimal point gets removed.
Therefore :-
double x = 3.14
int x = 3
Similar questions