Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program using C++ please also provide a screenshot of the output. thank you! will familiarize the student with using loops. You Learn about
Write a program using C++ please also provide a screenshot of the output.
thank you!
will familiarize the student with using loops. You Learn about Fibonacci This lab sequence generation, finding subtotals, 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 er 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: 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. Enter N: 3 Sum of 1 to 36 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: Enter N 4 First 4 Fibonacci numbers ar F(1) = 1 E(2) = 1 F(3) = 2 F (4)3 Sum of the first 4 Fibonacci numbers7 Average of the first 4 Fibonacci numbers 1.75 ore before 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: Enter N: 8 Enter M: 3 8 Fibonacci numbers printed with sequence number multiple of 3: F (3) 2 F (6)8Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started