20.09.2015 Views

Programming in C

Kochan - ProgramminginC

Kochan - ProgramminginC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

viii<br />

Contents<br />

Comb<strong>in</strong><strong>in</strong>g Operations with Assignment:The<br />

Assignment Operators 38<br />

Types _Complex and _Imag<strong>in</strong>ary 39<br />

Exercises 40<br />

5 Program Loop<strong>in</strong>g 43<br />

The for Statement 44<br />

Relational Operators 46<br />

Align<strong>in</strong>g Output 50<br />

Program Input 51<br />

Nested for Loops 53<br />

for Loop Variants 54<br />

The while Statement 56<br />

The do Statement 60<br />

The break Statement 62<br />

The cont<strong>in</strong>ue Statement 62<br />

Exercises 63<br />

6 Mak<strong>in</strong>g Decisions 65<br />

The if Statement 65<br />

The if-else Construct 69<br />

Compound Relational Tests 72<br />

Nested if Statements 75<br />

The else if Construct 76<br />

The switch Statement 84<br />

Boolean Variables 87<br />

The Conditional Operator 91<br />

Exercises 93<br />

7 Work<strong>in</strong>g with Arrays 95<br />

Def<strong>in</strong><strong>in</strong>g an Array 96<br />

Us<strong>in</strong>g Array Elements as Counters 100<br />

Generat<strong>in</strong>g Fibonacci Numbers 103<br />

Us<strong>in</strong>g an Array to Generate Prime Numbers<br />

104<br />

Initializ<strong>in</strong>g Arrays 106

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!