Below is the java code to print and convert Fahrenheit to Celsius.
Output:
Enter the temperature in Fahrenheit: 70
Temperature in Celsius = 21.11111
import java.util.*;
class FahrenheitToCelsius {
public static void main(String[] args) {
float temperature;
Scanner in = new Scanner(System.in);
System.out.print("Enter the temperature in Fahrenheit: ");
temperature = in.nextInt();
temperature = (temperature - 32) * 5 / 9;
System.out.println("Temperature in Celsius = " + temperature);
}
}
Output:
Enter the temperature in Fahrenheit: 70
Temperature in Celsius = 21.11111
but why do you need float temperature; and Scanner in = new Scanner(System.in); ??
ReplyDeleteReally Nice Information,Thank You Very Much For Sharing.
ReplyDeleteWeb Development Company
This article is nicely written. A very well written guide to take care of your furnace.
ReplyDeletetop seo services in lahore pakistan
Penthouse Apartment at Mabeyn Sahil is a unique apartment within the city that has outstanding sea view of the city. Contact Us for buying penthouse apartment in turkey.
ReplyDeleteNo doubt this is an excellent post I got a lot of knowledge after reading good luck. Theme of blog is excellent there is almost everything to read, Brilliant post visit my website for Buy Generic Viagra 200 Mg Online without prescription. Only $1 per pill. Free shipping . Approved online pharmacy. sildenafil 200
ReplyDeleteVery interesting, good job and thanks for sharing such a good blog and if you want to buy Valacyclovir 500 Mg Online without prescription. Only $1.25 Per Pill. Free shipping. Approved online pharmacy.Visit Please buy centrex 500mg tablets
ReplyDelete