Question: Need help writing this code This project will familiarize the student with using while loops. You Learn about Fibonacci sequence generation, finding subtotals and average.

Need help writing this code Need help writing this code This project will familiarize the student with

This project will familiarize the student with using while loops. You Learn about Fibonacci sequence generation, finding subtotals and average. Here are 8 Fibonacci numbers: 1, 1,2,3,5,8,13, 21 Note that the first Fibonacci number is 1, F(1) = 1 The second Fibonacci number is 1, i.e. F(2) = 1 Other Fibonacci numbers in the sequence is the sum of two previous Fibonacci numbers. For example F(3) = F(2) + F(1). In general F(n) = F(n-1) + F(n-2) Write a program to do the following tasks. User entries are shown in bold. First print your name in capital letters. 1) Ask user to enter a value for N. Find the sum of first N positive integer numbers. For example for N=3, you add numbers 1+2+3 which results in answer of 6. Part 1: Sum of first N positive integers: Enter N: 3 Sum of first 3 positive integer numbers is 6. 2) Ask user to enter a value for N. Print first N numbers in Fibonacci sequence. For example for N = 4, you generate the following output: Part 2: Print first N Fibonacci numbers, their sum and average: Enter N: 4 First 4 Fibonacci numbers are: F(1) = 1 F(2) = 1 F(3) = 2 F(4) = 3 Sum of the first 4 Fibonacci numbers - 7 Average of the first 4 Fibonacci numbers = 1.75 3) Ask user to enter a value for N. Ask user to enter a value for M. You want to calculate first N Fibonacci numbers but output only every Mth term. (Use modulus operator %). For example if N=8 and M=3, then your output should be as follows: Part 3: Generate N Fibonacci numbers but print every M term: Enter N: 8 Enter M: 3 8 Fibonacci numbers printed with sequence number multiple of 3: F(3) = 2 F(6) = 8

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!