Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a program to convert this temperature into Centigrade degrees.
Overall, this program is a basic example of how Java can be used to perform simple mathematical operations and input/output operations, specifically for temperature conversions.
import java.util.Scanner; class Centigrade_Degree { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.println("Enter the Fahrenheit degrees :"); float fr = input.nextFloat(); float cd = ((fr-32)*(5.0f/9.0f)); System.out.println("Temparture in Centigrade : "+cd); } }
Enter the Fahrenheit degrees : 45.67 Temparture in Centigrade : 7.594444
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions