Output:
Click Here For Java Online Compiler
Solution:
*** Check Whether Any Number Is Double Or Not *** Enter any number: 930475 It's not a double number ------------------------------------------------- *** Check Whether Any Number Is Double Or Not *** Enter any number: 3452.56 It's a double number
Click Here For Java Online Compiler
Solution:
import java.util.Scanner; public class TestIfNumIsDouble { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("*** Check Whether Any Number Is Double Or Not ***" + "\n"); System.out.print("Enter any number: "); double number = scanner.nextDouble(); if ((number % 1) == 0) { System.out.println("It's not a double number"); } else { System.out.println("It's a double number"); } } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon