java program to convert fahrenheit to celsius | Celsius to Fahrenheit

java program to convert fahrenheit to celsius | Celsius to Fahrenheit

/*java program For Celsius to Fahrenheit converion*/
import java.util.*;

class CelsiusToFahrenheit {
  public static void main(String[] args) {
    float temperatue;
    Scanner in = new Scanner(System.in);     

    System.out.println("Enter temperatue in Celsius");
    temperatue = in.nextInt();

  temperatue = (9* temperatue)/5 + 32;

    System.out.println("Temperatue in Fahrenheit = " + temperatue);
  }
}


/*java program For Fahrenheit to Celsius converion*/
import java.util.*;

  class FahrenheitToCelsius {
  public static void main(String[] args) {
    float temperatue;
    Scanner in = new Scanner(System.in);     

    System.out.println("Enter temperatue in Fahrenheit");
    temperatue = in.nextInt();

    temperatue = ((temperatue - 32)*5)/9;

    System.out.println("Temperatue in Celsius = " + temperatue);
  }
}

Related Posts