0

If...else statement

How do I write a C program that receives six(6) float values from the keyboard then determine the highest of these 6 numbers using the if....else if construct. If all the six numbers are equal, then print the message"All Numbers Are Equal" ?

29th Dec 2017, 2:05 AM
Stefan
Stefan - avatar
1 Odpowiedź
0
Option A: 1) Store the input in an array; 2) You can use a recursive function will compare 2 numbers and stores the result. It will take as input each of the combinations of the 6 numbers taken 2 at a time. The combination formula is: let n=6 and r=2 the nCr=n!/r!(n-r)! Option B (recommended): Not try to reinvent the wheel, and just use an existing sorting algorithm. "Bubble Sort" is one of such algorithms. You can search Sololearn (or Google) for "Bubble Sort implementation in C."
29th Dec 2017, 7:42 AM
Zinc
Zinc - avatar