Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 3 Dr. Nazari ECE 1310 This project will familiarize the student with using while loops. You Learn about Fibonacci sequence generation, finding subtotals and

image text in transcribed
Project 3 Dr. Nazari ECE 1310 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 Page 1

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

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

2. Do you find change a. invigorating? b. stressful? _______

Answered: 1 week ago

Question

How was their resistance overcome?

Answered: 1 week ago