CPPForSchool.com: Flow of Control Set 2: Assignment 13
13.
Write a program to calculate the sum of following series where n is input by user.
1 + 1/2 + 1/3 + 1/4 + 1/5 +…………1/n
This assignment was not too difficult. However, when my source code is compared to the sample source solution, I once again took a different approach by comparison. Unlike the use of int, float, and a for loop, my approach was to utilize double and a while loop.
1 + 1/2 + 1/3 + 1/4 + 1/5 +…………1/n
This assignment was not too difficult. However, when my source code is compared to the sample source solution, I once again took a different approach by comparison. Unlike the use of int, float, and a for loop, my approach was to utilize double and a while loop.
Comments
Post a Comment