Friday, August 2, 2013

Degree Converter

1.Class Name: DegreeConverter.

import java.util.*;

class DegreeConverter {
  public static void main(String[] args) {
    float temperature;
    double c,f;
   
    Scanner in = new Scanner(System.in);     

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

   c = ( f-32)/1.8;

    System.out.println("Temperature in Celsius = " + c);
  }
}

No comments:

Post a Comment