Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // HW
- import java.util.Scanner;
- public class BiggestAfterDot {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- double input, fragValue, biggest = Double.MIN_VALUE;
- System.out.println("Enter real numbers. Stop your inputs with 0:");
- do
- {
- input = in.nextDouble();
- fragValue = input - (int)input;
- if(fragValue > biggest)
- biggest = input;
- }
- while(input != 0);
- System.out.printf("The number with the biggest fragments value is %f", biggest);
- in.close();
- }
- }
Add Comment
Please, Sign In to add comment