
Java
Scanner class to read user input. First, prompt the user to enter the temperature in Celsius, then apply the formula F = (C * 9/5) + 32 to convert it to Fahrenheit. Finally, display the result. Here's a simple code snippet:
<code class="language-Java">import Java.util.Scanner;public class CelsiusToFahrenheit { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter temperature in Celsius: "); double celsius = scanner.nextDouble(); double fahrenheit = (celsius * 9/5) + 32; System.out.println("Temperature in Fahrenheit: " + fahrenheit); } }
</code>
Copyright © 2026 eLLeNow.com All Rights Reserved.