0% found this document useful (0 votes)
13 views1 page

05_LabManual_ENG3202_Lab5 (4)

Uploaded by

rocksports847
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

05_LabManual_ENG3202_Lab5 (4)

Uploaded by

rocksports847
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ENG3202 Computer Programming

LAB 5: LOOP STRUCTURES [DO-WHILE STATEMENT]

Objective To study and apply the concept of repetitive statement


To distinguish between the decision making tool in the form of do..while

Equipment Personal Computer with C Program Pre-Installed

Questions

1. Write a program that calculates two values, v1 and v2 from numbers 0 to 10


using do.. while loop and uses tabs to print the values. The formula and
calculated values are shown in Table 6.1.

Table 6.1
Number (n) v1=3(n+n) v2=3(n+n)+n
0 0 0
1 6 7
2 12 14
3 18 21
4 24 28
5 30 35
6 36 42
7 42 49
8 48 56
9 54 63
10 60 70

2. Write a loop that will calculate the sum of every second integer, beginning
with i = 1 (i.e, calculate the sum 1+3+5+7+…) for all values of i that are less
than 250. Write the loop using a do.. while statement.

You might also like