Version without JavaScript, read-only: workshops, quizzes and running code are not available here. Full version · Catalogue · Sign in

Sequence

Celsius to Fahrenheit

Core exercise

Write celsiusVersFahrenheit(double celsius) that applies the formula F = C × 9 / 5 + 32.

A workshop goes here: you write and run code in it. It requires JavaScript.

Starting code

Exercices.java

public class Exercices {

    public static void main(String[] args) {
        System.out.println("100 C = " + celsiusVersFahrenheit(100) + " F");
    }

    public static double celsiusVersFahrenheit(double celsius) {
        // TODO
        return 0;
    }
}

The core exercise is validated in the workshop, which requires JavaScript.

Hint 1

Write 9.0 / 5 and not 9 / 5: between two integers, Java answers 1 and your whole conversion is wrong.