top of page

Simple Java program that will convert temperature from degree Centigrade to Fahrenheit

  • Writer: Nelson John
    Nelson John
  • Nov 24, 2017
  • 1 min read

import java.util.Scanner;

public class JavaApplication {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double celsius, fahrenheit;

System.out.print("Enter a temperature in Celsius: ");

celsius = sc.nextDouble();

fahrenheit = 32 + (celsius * 9 / 5);

System.out.println(celsius +" ºC = " + fahrenheit + " ºF");

}

}

This is what the output should look like

Enter a temperature in Celsius: 0

0ºC = 32ºF

Facebook: ayamnelrodinho1@gmail.com

Yahoo: talk2nelsonjohn2dat@yahoo.com

Whatsapp: +2349034595610

PLEASE KINDLY SHARE WITH FELLOW PROGRAMMERS AND ALSO SUBSCRIBE TO MY BLOG FROM THE HOME PAGE FOR MORE FEEDS.


 
 
 

Comments


bottom of page