Sunday 16 August 2015

Temperature of city in Fahrenheit degrees is input through the keyboard.WAP in java to convert this temperature into Centigrade degrees.

//Conversion of temperature from Fahrenheit to centigrade degrees

import java.util.Scanner;

class Temperature {

public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter temperature in Fahrenheit:");
float F=sc.nextFloat();

System.out.println("Temperature in Centigrade degrees:"+((5/9.0f)*(F-32)));
}

}

No comments:

Post a Comment