Company: Cognitive_20nov
Difficulty: medium
CreateNum Function Problem Description Implement the following function: int CreateNum(int a, int b, int c); The function accepts three integers a, b, and c. These values must first be sorted in descending order. The largest value is then assigned to x, the second largest to y, and the smallest to z. A 3-digit number 'xyz' is created using the values of x, y, and z. This integer is formed by the formula: (100 * x) + (10 * y) + z. Implement the function to calculate this integer and return the result. Examples Example 1: Input: a = 1, b = 8, c = 5 Output: 851 Explanation: - Descending order of a, b, c is {8, 5, 1}. - Substituting x, y, z as follows: - x = 8 - y = 5 - z = 1 - The integer xyz = (100 * x) + (10 * y) + z = (100 * 8) + (10 * 5) + 1 = 800 + 50 + 1 = 851. Example 2: Input: a = 3, b = 0, c = 7 Output: 730 Explanation: - Descending order of a, b, c is {7, 3, 0}. - Substituting x, y, z as follows: - x = 7 - y = 3 - z = 0 - The integer xyz = (100 * x) + (10 * y) + z = (100 * 7) +