Given three numbers, find Smallest of three integers without comparison operators. Do not make use of mathematical operators in this problem.
Explanation:
Take a count variable and initialize it with 0. In while loop, repeatedly subtract the three numbers with 1. The number which becomes 0 first, then it is the smallest number.
Java Program to find smallest of three integers without comparison operators
Java Program to find smallest of three integers without comparison operators
Output:
Enter 3 numbers : 1 2 3Smallest Number : 1
Enter 3 numbers : 4 3 6
Smallest Number : 3
No comments:
Post a Comment