Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

Students also viewed these Databases questions

Question

=+ Have I presented all the elements consistently?

Answered: 1 week ago

Question

Explain basic guidelines for effective multicultural communication.

Answered: 1 week ago

Question

Identify communication barriers and describe ways to remove them.

Answered: 1 week ago

Question

Explain the communication process.

Answered: 1 week ago