Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

C Programming for Engineers: Repetition Statements and Finding Average, Study notes of Engineering

The use of repetition statements in c programming, specifically the while statement, and provides an example of a program that outputs the square of a number repeatedly until it reaches 1024. Additionally, it explains how to write a program to find the average of a given number of user-inputted numbers.

Typology: Study notes

2009/2010

Uploaded on 03/28/2010

koofers-user-la8-1
koofers-user-la8-1 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE294A
Introduction to C Programming for Engineers
Lecture #6
Jeffrey Miller, Ph.D.
pf3
pf4
pf5

Partial preview of the text

Download C Programming for Engineers: Repetition Statements and Finding Average and more Study notes Engineering in PDF only on Docsity!

CSE294A

Introduction to C Programming for Engineers

Lecture

Jeffrey Miller, Ph.D.

Repetition Statements

Repetition statements allow you to specify that an action isto be repeated while some condition remains true

The while statement is one type of repetition statement int product = 2; while (product <= 1000) { product = 2 * product; printf (“%d\n”, product); } printf (“%d\n”, product); - What does this program output?

Finding the Average

Write a program to find the average of 10 numbers that areentered by the user

Then modify the program to find the average of as manynumbers as the user wants. In other words, ask the user forhow many numbers he would like to find the average?

Homework

Homework #2 is still posted!