Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CommaNumber {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         double x; // Declaring a double
  8.        
  9.         Scanner keyboardinput = new Scanner(System.in); // Input a double with the keyboard
  10.         System.out.println("Write a number with a comma."); // Message for user
  11.         x = keyboardinput.nextDouble();
  12.         double y = 1.0 / x; // Declare another double equal to 1.0 over x
  13.    
  14.         System.out.println(x);
  15.         System.out.println(y);
  16.         System.out.println(x*y);
  17.        
  18.  
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement