Wednesday, October 30, 2013

1.14 - Conversion

/*
 * Autor: Juan Antonio Ripoll
 * Date: 30/10/13
 * 
 * Create a JAVA program to convert from celsius degrees to Kelvin 
 * and Fahrenheit: it will ask the user for the amount of celsius degrees 
 * and using the following conversion tables: 

   kelvin = celsius + 273 
   fahrenheit = celsius x 18 / 10 + 32 
 * */

import java.util.Scanner;

public class Main {

 public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  
  System.out.print("Enter the amount of celsius: ");
  int celsius = in.nextInt();
  
  System.out.println("Kelvin = " + celsius + 273);
  System.out.println("Fahrenheit = " + celsius * 18 / 10 + 32);
 }
}

No comments:

Post a Comment