Write a program that reads a Celsius degree in a double value from the console, then converts it to Fahrenheit and displays the result. The formula for the conversion is as follows:
fahrenheit = (9 / 5) * celsius + 32
Solution:
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
double celcius, farenheit;
System.out.print("Enter a value for the celcis:");
celcius = s.nextDouble();
farenheit = (9/5) * celcius + 32;
System.out.print("The value of " + celcius + " degree celcius in farenheit is " + farenheit);
}
Subscribe to:
Post Comments (Atom)
I would love to see comments in each line as to what is its purpose in the code to make learning easier
ReplyDeleteI love this
ReplyDeletei like this becouse it's easy to help you
ReplyDelete