13.Write a program in C to find the minimum of two numbers without using the 'if' statement.
Generally speaking, finding a minimum means comparing two numbers. In C programming, we compare two numbers using relational operators. To compare two numbers (or other primitive types), we use the > or < operators. The relationship operator returns 1 (true) or 0 (false) depending on the condition.
We can write an expression to find the minimum n1 < n2 between n1 and n2. The expression n1 < n2 evaluates to 1 if n1 is less than n2, otherwise it evaluates to 0.
After finding the minimum, we need to perform some action based on the minimum, for example print the minimum number. In C, the if...else and conditional?: statements provide the ability to perform actions based on a condition. Therefore, we will use the conditional operator to find the minimum.
1.Below is step by step descriptive logic to find minimum using conditional operator ?:
Input two numbers from user.
Store it in variable say n1 and n2.
Check (n1 < n2) ? "n1 is minimum than n2":"n2 is minimum than n1" ;