codescracker


java

Java Program to Convert Centigrade to Fahrenheit



« Previous Program Next Program »


Convert Centigrade to Fahrenheit

To convert centigrade to Fahrenheit in Java Programming, you have to ask to the user to enter the temperature in centigrade to convert it into Fahrenheit to display the equivalent temperature in Fahrenheit as shown in the following program.

Java Programming Code to Convert Centigrade to Fahrenheit

Following Java Program ask to the user to enter temperature in centigrade to convert into Fahrenheit, then display the result on the screen :

/* Java Program Example - Convert Centigrade to Fahrenheit */
		
import java.util.Scanner;

public class JavaProgram
{
    public static void main(String args[])
    {
        float cen;
        double fah;
        Scanner scan = new Scanner(System.in);
		
        System.out.print("Enter Temperature in Centigrade : ");
        cen = scan.nextFloat();
		
        fah = (1.8*cen) + 32;
		
        System.out.print("Equivalent Temperature in Fahrenheit = " + fah);
    }
}

When the above Java Program is compile and executed, it will produce the following output:

Java Program convert centigrade to Fahrenheit

Same Program in Other Languages

You may also like to learn and practice the same program in other popular programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test