package com.mycompany.converttemperature;
import java.util.Scanner;
public class ConvertTemperature {
public static void main(String[] args) {
// Question 5. Write a program to convert a temperature given in degree Fahrenheit to degree Celsius.
// Hint use oC=5/9 *(oF-32)
Scanner scanner = new Scanner(System.in);
System.out.println("Enter degree of Fahrenheit: ");
double Fahrenheit = scanner.nextDouble();
double Celsius = 5.0/9 * (Fahrenheit - 32);
System.out.println("The degree of Celsius is:- "+Celsius);
//now you will get double number when you write one of them double division. like 5.0/9 * ( F - 32);
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter