Menu
Topics Index
...
`

Temperature Conversion


If you need explanation Read this topic

If you need Answer Take test on this topic

Temperature Conversion
What will be the output of the following program?
public class CelsiusConversion {
    public static void main(String[] args) {
        int c = 20;
        double kelvin = c + 273.15;
        System.out.println(kelvin);
        int Rankine = (int) (c + 273.15 * 9 / 5);
        System.out.println(Rankine);
        double delisle = (100 - c) * 3 / 2;
        System.out.println(delisle);
    }
}

A. 293.15
511
120.0
B. 293.15
511.66999999999996
120.0
C. Compilation Error
D. Runtime Error
Topic: Temperature Conversion Program In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

answer is option a since kelvin is double value,rankine is casted to int, and delisle is double

Posted by Sangeetha Ptl    2014-06-05 12:53:14


ans is a bcz
first kelvin is assigned value 293.15 then printed
rankine value is casted to int whose value =511 then printed
then delsile =80*3/2=240/2=120.0 then printed again

Posted by Pooja Singh    2014-06-05 14:10:20


Congratulations Sangeetha Ptl. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-06-06 04:20:44


© meritcampus 2019

All Rights Reserved.

Open In App