+ 1

What is the output of the code?

System.out.print((7/2)/2.0);

23rd Mar 2020, 7:18 AM
Kirti
Kirti - avatar
5 Answers
0
According to BODMAS You need to solve the bracket first so 7/2 will return 3. Then the resultant is divided with 2.0 which is a double value and the result of this operation will also be a double value. So 3/2.0 = 1.5 and remember that 3.0/2 will also give the same result.
23rd Mar 2020, 9:07 AM
Avinesh
Avinesh - avatar
+ 1
Why don't u code it and see what happens?
23rd Mar 2020, 7:20 AM
nichdiomajadoch
+ 1
(7/2)=3 3/2.0=1.5 if it is(just in another case) (7/2)=3 3/2=1
23rd Mar 2020, 7:31 AM
Muhammad Bilal
Muhammad Bilal - avatar
0
1.5
23rd Mar 2020, 7:25 AM
Kirti
Kirti - avatar
0
1.5
24th Mar 2020, 10:45 AM
Samavedam Praneeth
Samavedam Praneeth - avatar