Sunday, 1 June 2014

simple java program

import java.util.Scanner;
/* We import Scanner class from java.util package for
     taking input from the keyboard*/
class temperature
{
    public static void main(String []ars)
    {
        Scanner in=new Scanner(System.in);
        System.out.println("enter temperature in fahrenheit");
        float a=in.nextFloat();
        float b=(a-32)*5/9;
        System.out.println("temperature in celsius is"+b);
    }
}
       

No comments:

Post a Comment