Question: Number A (The three loops: 12 points) Write a single program in C allowing to: 1. calculate the value of the following sum with the
Number A (The three loops: 12 points)
Write a single program in C allowing to:
1. calculate the value of the following sum with the do ... while loop then display it:
a) sum1 = 20 + 30 + 40 + 50 +. . . + 120 + 130 + 140 + 150
b) sum2 = 20 + 40 + 80 + 160 + 320 + 640 + 1280
2. calculate the following sum with the while loop then display it:
a) sum3 = 1/5 + 1/7 + 1/9 + + 1/19 + 1/21 + 1/23 + 1/25 + 1/27
b) sum4 = 1 + 3 + 5 + 7 +. . . + 99 + 101 + 103
3. recalculate and display sum3 and sum4 using the for loop.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
