Nested conditional operator


Tuesday, October 31, 2023 Difficulty: Intermediate

Objective

Create a Java program that prompts the user to enter two integers (a, b) and determines how many of them are positive using nested conditional operators in Java.

Input

3
2

Output

The count of positive numbers is: 2

Solution

Click here to view the exercise solution

Share it

Share it on your social media and challenge your friends to solve programming problems. Together, we can learn and grow.

Copied

The code has been successfully copied to the clipboard.

More Exercises

Continue improving your Java programming skills with our selection of practical exercises from the lesson. Click on Practice and challenge your knowledge!

1

Basic calculator using if

Java basic calculator. Input numbers and operators (+, -, x, /) for calculation. If the symbol is not valid, it displays 'Character not recognized'.

Flow controls: Conditions

Practice with exercises in Java related to the conditions, loops and structures of the language.

Practice exercises

Keep learning

C# Programming Course

Free programming course with practical exercises and solutions in C#. Start learning right now!

CookieOwn and third party cookies to improve our services. If you go on surfing, we will consider you accepting its use.