Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Steven Bell
660 PointsTemperature Conversion
Write a program that converts degrees from Fahrenheit to Celsius, using the formula DegreesC = 5 (DegreesF − 32) / 9. Prompt the user to enter a temperature in degrees Fahrenheit as a whole number without a fractional part. Then have the program display the equivalent Celsius temperature, including the fractional part to at least one decimal point.
1 Answer

Jeremy Hill
29,567 Pointsimport java.util.Scanner;
public class Example{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
double c = 0;
double f =0;
System.out.println("Enter degrees in Fahrenheit: ");
f = input.nextInt();
c = (f-32)/9;
System.out.printf("The temperature in Celsius is: %.2f",c);
}
}
Jeremy Hill
29,567 PointsJeremy Hill
29,567 PointsThis should get you in right direction.