1cels = (fahr - 32.0) * 5.0/9.0; //Fahr to cels
2fahr = (cels * 9.0/5.0) + 32.0; //Cels to fahr
1import java.util.Scanner;
2
3public class Main {
4
5 public static void main(String args[]) {
6 Scanner sc = new Scanner(System.in);
7 int far = sc.nextInt();
8 int cel = (far - 32) * 5/9;
9 System.out.printf("%d Fahrenheit is %d Celsius", far, cel);
10 }
11}
1function fahrenheitToCelsius(fahrenheit) {
2 return (((fahrenheit - 32) * 5) / 9).toFixed(1);
3} // Using toFixed returns a decimal value
4
5function celsiusToFahrenheit(celsius) {
6 return ((9 * celsius) / 5 + 32).toFixed(1);
7} // Better to multiply in this order for celsius