lab 2___Question 5

PHOTO EMBED

Mon Mar 27 2023 18:33:01 GMT+0000 (Coordinated Universal Time)

Saved by @Mohamedshariif #java

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);
        
     
    }
}
content_copyCOPY