Java Celcius to Farenheit Conversion Program in java



Question:

Write a program to convert  Celsius to Farenheit.  Display the result correct to 1 decimal.

Create a class “CelsiusConversion.java” and write the main method.

Hint : 5 * (F – 32) = 9 * C,  F-Farenheit , C- Celsius

Sample Input  1 :

80

Sample Output  1 :

176.0

Sample Input  2 :

88

Sample Output  2 :

190.4

CODE:

import java.util.Scanner;


public class CelsiusConversion
{
    public static void main (String[] args) {
        Scanner sc=new Scanner(System.in);
        double cel=sc.nextDouble();
        double fah=((9*cel)/5)+32;
        System.out.println(fah);
    }
}

 


Tags:

java interview programs for experienced | java interview programs for freshers pdf | java coding questions for 5 years experience | java programming interview questions – geeksforgeeks |
java programming interview questions and answers for freshers | java programs asked in interview for automation tester | java coding interview questions for experienced professionals
| java coding interview questions pdf

Previous
Next Post »