Question: CS 254 Program 2- Harmonic Numbers 1st thru 5th harmonics of a vibrating string The nth partial sum of the diverging harmonic series, 71 k

 CS 254 Program 2- Harmonic Numbers 1st thru 5th harmonics of

CS 254 Program 2- Harmonic Numbers 1st thru 5th harmonics of a vibrating string The nth partial sum of the diverging harmonic series, 71 k" ko1 is called the nth harmonic number. Write a program in Java or C that asks the user for n, and then computes the nth harmonic number in four ways: N-3 1. Sum the terms from 1/1 up to 1. Use single precision variables (primitive type float) for the sum and each term. 2. Sum the terms from 1 down to 1/1. Use single precision variables (primitive type float) for the sum and each term. 3. Sum the terms from 1/1 up to 1. Use double precision variables (primitive type double) for the sum and each term. 4. Sum the terms from 1 down to 1/1. Use double precision variables (primitive type double for the sum and each term. answer for each of the four. Use an integer loop control variable for the the series to the partial sum. User interaction will look something like: Write out each of the four sums. For n large enough you will get a different counting loops. Type cast it to single or double when you add each term of Upper Limit >100 upward sum (float)x.xxxx downward sum (float ) x.xxxx.. upward sum (double) x.xxxx downward sun (double) x.xxxx

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!