If - else if simulation

C does not have a special if-else if construct. If you want to implement something like the following table you have to use nested if-elses. However, they can be rewritten to look (and read) like an if-else if .

           salary            message

           >= 60000          Big bucks
           35000-59999       Medium bucks
           25000-34999       Little bucks
           < 25000           Pittance

Actual C logic

if (salary > 60000) printf("\nBig bucks"); else if (salary >= 35000) printf("\nMedium bucks"); else if (salary >= 25000) printf("\nLittle bucks"); else printf("\nPittance");

How the above is written to "look like" an if-else if

if (salary > 60000) printf("\nBig bucks"); else if (salary >= 35000) printf("\nMedium bucks"); else if (salary >= 25000) printf("\nLittle bucks"); else printf("\nPittance");