Menu
Question Index
...

Write a program to verify the given numbers are valid or not.

Input (Numbers) Output
{12.0, 23.45, 16.98, 9.07, 23.56} true
{0.0, 0.045, 0.98, 0.07, 0.56} true
{-12.0, -23.45, -16.98, -9.07, -23.56} true
{-0.0, -0.045, -0.98, -0.07, -0.56} true
{0.0, 0.045, Double.POSITIVE_INFINITY, Double.NaN, Double.NEGATIVE_INFINITY, 0.87, 0.56} false
{0.02, 0.045, Double.NaN, null, 0.87, 0.56} false



class ValidNumbers
{
    public static void main(String s[])
    {
        Boolean result = areValidNumbers(0.23, 12.34, 45.67, -23.12, -0.23, 0.0, 100.08);
        System.out.println("The given numbers {0.23, 12.34, 45.67, -23.12, -0.23, 0.0, 100.08} are valid "+result);

    }


        public static Boolean areValidNumbers(Double... numbers)
        {
            Boolean result = null;
            return result;
        }

}

Doubts

Problems

Topic: Java isInfinite() And isNaN() Methods In Double Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App