How can i convert a Celsius to Fahrenheit be using keyboard scanner?

1 answer

Answer

1193873

2026-05-19 19:00

+ Follow

Java
Java

To convert Celsius to Fahrenheit using a keyboard scanner in Java, you can utilize the 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>
ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.