KnowledgeBoat Logo

Computer Applications

Write a program to input the temperature in Celsius and convert it into Fahrenheit. If the temperature is more than 98.6 °F then display "Fever" otherwise "Normal".

Java

Input in Java

67 Likes

Answer

import java.io.*;

public class KboatTemperature
{
    public static void main(String args[]) throws IOException {
        
        InputStreamReader read = new InputStreamReader(System.in);
        BufferedReader in = new BufferedReader(read);
        
        System.out.print("Enter temperature in Celsius: ");
        double cel = Double.parseDouble(in.readLine());
        
        double far = 1.8 * cel + 32;
        
        if (far > 98.6)
            System.out.println("Fever");
        else
            System.out.println("Normal");
    }
}

Output

BlueJ output of Write a program to input the temperature in Celsius and convert it into Fahrenheit. If the temperature is more than 98.6 °F then display "Fever" otherwise "Normal".BlueJ output of Write a program to input the temperature in Celsius and convert it into Fahrenheit. If the temperature is more than 98.6 °F then display "Fever" otherwise "Normal".

Answered By

22 Likes


Related Questions