4. Write a program that allows user to convert Celsius to Fahrenheit. Displays the output of Celsius to Fahrenheit in a table. Entries in the table should range from 10 to 100 degrees Celsius with increments of 2 degrees.
• The formula f= (9/5 * c) + 32 converts Celsius to Fahrenheit.
The result format should have one decimal place. Example 3.3 @ 4.5
1
Expert's answer
2017-02-23T14:13:05-0500
public class CelsiusToFahrenheit {
public static void main(String[] args) { double f; for (int i = 10; i <= 100; i += 2) { f = (9.0 / 5.0 * i) + 32; System.out.print("Celsius = " + i + " Fahrenheit = "); System.out.printf("%.1f", f); System.out.println("");
Comments
Leave a comment