import java.util.*;
class TemperatureC
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter 1 for Celcius to Fahrenheit : ");
System.out.println("Enter 2 for Fahrenheit to Celcius : ");
System.out.println("Enter your choice :");
int ch = sc.nextInt();
switch (ch) {
case 1:
System.out.println("Enter Temperature in Celcius : ");
double Cel = sc.nextDouble();
double Far = ((Cel * 9) / 5) + 32;
System.out.println("Temperature in Fahrenheit : " + Far);
break;
case 2:
System.out.println("Enter Temperature in Fahrenheit : ");
double far = sc.nextDouble();
double cel = ((far - 32) * 5) / 9;
System.out.println("Temperature in Celcius : " + cel);
break;
default:
System.out.println("Invalid choice entered.");
break;
}
}
}
What is wrong here?
The same code is running everywhere else than Replit, why?