AgentTadpole

Answers - Celsius to Fahrenheit Converter

Jan 17th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.39 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CtoF {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.        
  7.         System.out.print("Enter degrees in Celsius to be converted: ");
  8.         String strC = scanner.next();
  9.         double c = Double.parseDouble(strC);
  10.         double f =  c * 9 / 5 + 32;
  11.         System.out.println(c + " in Fahrenheit is " + f);
  12.        
  13.         scanner.close();
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment