Shavit

Ex. Bank #24

Dec 7th, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. // Shavit Borisov
  2. // HW
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class BiggestAfterDot {
  7.  
  8.     public static void main(String[] args)
  9.    
  10.     {
  11.         Scanner in = new Scanner (System.in);
  12.        
  13.         double input, fragValue, biggest = Double.MIN_VALUE;
  14.        
  15.         System.out.println("Enter real numbers. Stop your inputs with 0:");
  16.        
  17.         do
  18.         {
  19.             input = in.nextDouble();
  20.             fragValue = input - (int)input;
  21.            
  22.             if(fragValue > biggest)
  23.                 biggest = input;
  24.         }
  25.         while(input != 0);
  26.        
  27.         System.out.printf("The number with the biggest fragments value is %f", biggest);
  28.        
  29.         in.close();
  30.     }
  31. }
Add Comment
Please, Sign In to add comment