Created
October 3, 2022 22:00
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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