Skip to content

Instantly share code, notes, and snippets.

@rmg007
Created October 3, 2022 22:00
Show Gist options
  • Select an option

  • Save rmg007/46a8a81eb80832fdc8062550d5c57f94 to your computer and use it in GitHub Desktop.

Select an option

Save rmg007/46a8a81eb80832fdc8062550d5c57f94 to your computer and use it in GitHub Desktop.
learn and dive deep into Java. Scanner Methods and More Examples lecture part 2
import java.util.Scanner;
public class Main {
/*
Make a program that takes Fahrenheit temperature and converts it to Celsius
Formula: c = (f - 32) / 1.8;
*/
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double f = in.nextDouble();
double c = (f - 32) / 1.8;
System.out.printf("The celsius is: %f", c);
in.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment