public class Solution { public static void main(String[] args) { System.out.printf("%s\t%s\t%s\t%s\n", "Celsius", "Fahrenheit", "Fahrenheit", "Celsius"); for(double i = 40, j = 120; i >= 31 && j >= 30; i--, j -= 10) System.out.printf("%.1f\t%.2f\t%.1f\t%.2f\n", i, celsiusToFahrenheit(i), j, fahrenheitToCelsius(j)); } public static double celsiusToFahrenheit(double celsius) { return (9.0 / 5) * celsius + 32; } public static double fahrenheitToCelsius(double fahrenheit) { return (5.0 / 9) * (fahrenheit - 32); } }