Fahrenheit to Celsius coderinme

Fahrenheit to Celsius coderinme

The formula to convert Fahrenheit to Celsius is as follows:
We know the temperature T in degrees Celsius (°C) is equal to the temperature T in degrees Fahrenheit (°F) minus 32, times 5/9:
Mathematically it is:
T(°C) = (T(°F) – 32) × 5/9
Let us now write a program to convert the given temperature in Fahrenheit to Celsius using the following conversion formula C = F-32 / 1.8 and display the value in a tabular form.

import java.io.*;
public class Q1
{
public static void main(String[] args) throws IOException
{
BufferedReader inp = new BufferedReader(new InputStreamReader(System.in));
double fah,cel;
System.out.print("Enter temperature in fahrenheit: ");
fah = Double.parseDouble(inp.readLine());
cel = (fah - 32) / 1.8;
System.out.println("Your Enter temperature in fahrenheit is :"+fah);
System.out.println("Converted Temperature into Celsius is :"+cel);
}
}

For more programs on Java, visit our Java Archives

Fahrenheit to Celsius

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.