Computer Science, asked by kabitachakraborty50, 19 days ago

write a program to input 3 unique integers and print the smallest among them without using the logical operator && (and).​

Answers

Answered by laxmi029193
0

Answer:

Write a program to find the smallest of three integers, without using any of the comparison operators.

Let 3 input numbers be x, y and z.

Method 1 (Repeated Subtraction)

Take a counter variable c and initialize it with 0. In a loop, repeatedly subtract x, y and z by 1 and increment c. The number which becomes 0 first is the smallest. After the loop terminates, c will hold the minimum of 3.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.

Explanation:

please mark me as brilliant

Answered by upendra7382
1

Answer:

Write a program to find the smallest of three integers, without using any of the comparison operators.

Let 3 input numbers be x, y, and z.

Method 1 (Repeated Subtraction)

Take a counter variable c and initialize it with 0. In a loop, repeatedly subtract x, y and z by 1 and increment c. The number which becomes 0 first is the smallest. After the loop terminates, c will hold a minimum of 3.

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.

Explanation:

Similar questions