O'Reilly logo

Learn to Program with C by Noel Kalicharan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 5

image

Programs with Repetition Logic

In this chapter, we will explain the following:

  • How to use the while construct to perform “looping” in a program
  • How to find the sum and average of an arbitrary set of numbers
  • How to get a program to “count”
  • How to find the largest and smallest of an arbitrary set of numbers
  • How to read data from a file
  • How to write output to a file
  • How to use the for construct to perform “looping” in a program
  • How to produce tables using for

5.1 Introduction

In Chapter 3, we showed you how to write programs using sequence logic—programs whose statements are executed “in sequence” from the first to the last.

In Chapter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required