Convert celsius to fahrenheit in java

In this tutorial, we will see simple java program to convert celsius to fahrenheit in java.
You can convert celsius to fahrenheit using this formula.

fh = (1.8*cen) + 32;
import java.util.Scanner;

public class TempConvertor
{
    public static void main(String args[])
    {
        float cen;
        double fh;
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter Temperature in Centigrade : ");
        cen = scanner.nextFloat();

        fh = (1.8*cen) + 32;

        System.out.print("Equivalent Temperature in Fahrenheit = " + fh);
    }
}

Output:

Enter Temperature in Centigrade : 30
Equivalent Temperature in Fahrenheit = 86.0
[social_share share_on="facebook,twitter,linkedin,whatsapp"][post_navigator in_same_term="true"]

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.