Java Program to calculate Celsius to Fahrenheit

Sample Input 1:

Enter the Celsius:1

Sample Output 1:

The Fahrenheit Is:33.8

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

public class Hello { public static void main(String args[]) { //Write your code here } }

Program or Solution

				
			
					
import java.util.*;
class Converter
{
   public static void main(String args[])
   {
       double fahreheit,celsius;
       Scanner sc=new Scanner(System.in);
       System.out.println("Enter The Celsius:");
       celsius=sc.nextDouble();
       fahreheit=celsius*1.8+32;
       System.out.println("The Fahreheit Is:"+fahreheit);
   }
}
			
				
			

Program Explanation

Get celsius as input (using scanner class) Calculate fahreheit using Formula fahreheit=celsius*1.8+32; print fahreheit (using system.out.println).

Comments