Compare three numbers and treat if they’re equal | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Compare three numbers and treat if they’re equal

Hey guys please help me to write a C program that reads three numbers typed on the keyboard, then it displays their minimum. And treat the case where the three numbers are equal. The code I tried is below and the problem is when they’re equal it should only say so without telling me the min . Please helpppp https://code.sololearn.com/cr48jqTKQO1A/?ref=app

5th Oct 2022, 4:37 PM
Kawtar
Kawtar - avatar
2 Answers
5th Oct 2022, 5:33 PM
Nicolae Crefelean
Nicolae Crefelean - avatar
0
First note that in if-else block : If the 'if condition is then it executes it's block of code. Don't check else. Only when condition is false then it goes to else part. example: in your code, if I enter 5 5 5 then by if part 5<=5 is true then it sets min=B; no else part executed so no outputs also..
5th Oct 2022, 4:52 PM
Jayakrishna 🇮🇳