Chilling halt to a warm conversion

Report a typo

Create a program that repeatedly converts temperatures from Celsius to Fahrenheit until a negative Celsius value is entered. Fill the blanks in the code to complete the temperature converter. How can you make this program work as described?

Fill in the gaps with the relevant elements
public class CelsiusToFahrenheit {
    public  void main(String[] args) {
        java.util.Scanner scanner = new java.util.Scanner(System.in);
         celsius = scanner.nextDouble();
         (celsius >= 0) {
            double fahrenheit = (celsius * 9 / 5) + 32;
            System.out.printf("%.1f°C = %.1f°F\n", celsius, fahrenheit);
            celsius = scanner.nextDouble();
        }
        scanner.close();
    }
}

Create a free account to access the full topic