A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a Java program that accepts two double variables and test if both strictly between 0 and 1 and false otherwise
Q:

Write a Java program that accepts two double variables and test if both strictly between 0 and 1 and false otherwise

0

Write a Java program that accepts two double variables and test if both strictly between 0 and 1 and false otherwise

Sample Output:
Input first number: 5
Input second number: 1
false

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {

		 Scanner in = new Scanner(System.in);

		 System.out.print("Input first number: ");

         double n1 = in.nextDouble();

         System.out.print("Input second number: ");

         double n2 = in.nextDouble();

		 System.out.println(n1 > 0 && n1 < 1 && n2 > 0 && n2 < 1);

	}

}

Sample Output:

(101 + 0) / 3)-> 33
(3.0e-6 * 10000000.1)-> 30.0000003
(true && true)-> true
(false && true)-> false
((false && false) || (true && true))-> true
(false || false) && (true && true)-> false

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now