Tutorials and C programs with code and output for beginners
c programming
C > 04. Loops
  1. A Simple Count from 1 to 100
    A program that displays the numbers between 1 and 100.
  2. Mission to the Moon
    This program computes the length of a mission to take photographs around the Moon given the time it takes to get there and to go around the Moon once.
  3. The Fuel Tank Program
    A program that monitors the amount of fuel in a tank and gives a warning if the supply falls below 10% of the tank's capacity.
  4. Simple Countdown Using a for Loop
    A program that displays all the numbers between 60 and 0 and then prints the word LIFTOFF afterwards.
  5. Sums and Averages
    A program that computes the average of all the numbers in a file of integers.
  6. Birdwatching Program I (Fixed Loop / File Input)
    This program reads a file that contains 12 lines of bird sightings and adds up all the sightings for a year.
  7. Birdwatching Program II (EOF Loop / feof)
    A program similar to the previous one but with an unknown number of records in the file.
  8. Birdwatching Program III(EOF Loop / With Status Variable)
    The same program that works with an unknown number of records but uses a status variable instead of the foef statement.
  9. Birdwatching Program IV (EOF Loop / Without Status Variable)
    The same program that works with an unknown number of records but does not use a status variable nor an foef statement.
  10. Input Validation Loop (do-while Loop)
    The best use of a do-while loop: An input validation loop. This program validates that the color entered is a valid traffic light color.
  11. The Company Payroll Program
    A program that computes the payroll for a company.
  12. The Fahrenheit-to-Celcius Conversion Table
    A program that displays a table of conversions between degrees Celcius and Fahrenheit with a specified start, end, and step.
COPYRIGHT © 2015-2024 IHY PRESS Frankfurt am Main 60329 Deutschland