How to find the larger number between two numbers using switch case statements in C language? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find the larger number between two numbers using switch case statements in C language?

I know how to write a program for the above question using the if-else statements but its really confusing to do it using switch case. Could anyone explain the logic and steps on how to solve this problem? Thanks!!

21st Sep 2018, 3:53 PM
Yusha Arif
Yusha Arif - avatar
1 Answer
0
Thanks alot Supriya Gangapatnam. I just wanted to know wheather inequalities were allowed in switch case. I thought only the == relational operator could be used in switch case which is why i was confused as to how to solve a problem that required a > or < operator. I also dont understand the cases. You didnt declare a boolean variable anywhere so how come the outcomes of switch(a>b) be 0(false) and 1(true) ?
22nd Sep 2018, 3:44 AM
Yusha Arif
Yusha Arif - avatar