IHYPRESS PROGRAMMING
Tutorials and C programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
C > 03. Selection Structures
  1. Simple if Statement Example
    A program that asks the user for a temperature and displays a different message if the temperature is above or below 20 degrees.
  2. Traffic Light Program (nested ifs)
    A program that displays the recommended actions depending on the color of a traffic light. This program uses nested if statements.
  3. Traffic Light Program (switch)
    A program that displays the recommended actions depending on the color of a traffic light. Unlike the previous program, this implementation uses the switch statement.
  4. Even vs. Odd Program
    A program that determines if an integer number is odd or even.
  5. Heart Rate Program
    A program that asks the user for the number of hearbeats in 10 seconds, calculates the heartbeats per minute and makes a health recommendation.
  6. Switching Values Program
    A program that askes the user for two numbers in variables x and y and switches them if the number in x is larger than the number in y.
  7. Water Bill Program
    This program figures a water bill based on the demand charge ($35) and a $1.10 per 1000 gallons use charge. A $2 surcharge is added to accounts with an unpaid balance.
  8. Conservation Water Bill Program
    The same water bill program but with added conservation requirements.
  9. Income Tax Program
    A program that calculates the income tax due depending on the income bracket.
  10. Warship Class Program
    A program that determines the class of a warship based on her serial number.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland