Write a program to create the following pattern up to the given number 'n', where n>...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to create the following pattern up to the given number 'n', where n> 3, and n<128. 1, 1, 2, 3, 5, 8.... pls note: add previous two number and generate new number For example: if given number is 7 (ie. n=7), then the result should be 1, 1, 2, 3, 5, 8, 13. Fo example: if given number is 9 (ie. n=9), then result should be 1, 1, 2, 3, 5, 8, 13, 21, 34 Input format The input should be an integer. Output format The output should be the series pattern based on the input. If the number is less than 3, print as "Error, number should be greater than 3" and if the number is greater than 128, print as "Error, number should be less than 128". Sample testcases Input 1 7 Input 2 2 Output 1 1, 1, 2, 3, 5, 8, 13 Output 2 Error, number should be greater than 3 Write a program to create the following pattern up to the given number 'n', where n> 3, and n<128. 1, 1, 2, 3, 5, 8.... pls note: add previous two number and generate new number For example: if given number is 7 (ie. n=7), then the result should be 1, 1, 2, 3, 5, 8, 13. Fo example: if given number is 9 (ie. n=9), then result should be 1, 1, 2, 3, 5, 8, 13, 21, 34 Input format The input should be an integer. Output format The output should be the series pattern based on the input. If the number is less than 3, print as "Error, number should be greater than 3" and if the number is greater than 128, print as "Error, number should be less than 128". Sample testcases Input 1 7 Input 2 2 Output 1 1, 1, 2, 3, 5, 8, 13 Output 2 Error, number should be greater than 3 Write a program to create the following pattern up to the given number 'n', where n> 3, and n<128. 1, 1, 2, 3, 5, 8.... pls note: add previous two number and generate new number For example: if given number is 7 (ie. n=7), then the result should be 1, 1, 2, 3, 5, 8, 13. Fo example: if given number is 9 (ie. n=9), then result should be 1, 1, 2, 3, 5, 8, 13, 21, 34 Input format The input should be an integer. Output format The output should be the series pattern based on the input. If the number is less than 3, print as "Error, number should be greater than 3" and if the number is greater than 128, print as "Error, number should be less than 128". Sample testcases Input 1 7 Input 2 2 Output 1 1, 1, 2, 3, 5, 8, 13 Output 2 Error, number should be greater than 3 Write a program to create the following pattern up to the given number 'n', where n> 3, and n<128. 1, 1, 2, 3, 5, 8.... pls note: add previous two number and generate new number For example: if given number is 7 (ie. n=7), then the result should be 1, 1, 2, 3, 5, 8, 13. Fo example: if given number is 9 (ie. n=9), then result should be 1, 1, 2, 3, 5, 8, 13, 21, 34 Input format The input should be an integer. Output format The output should be the series pattern based on the input. If the number is less than 3, print as "Error, number should be greater than 3" and if the number is greater than 128, print as "Error, number should be less than 128". Sample testcases Input 1 7 Input 2 2 Output 1 1, 1, 2, 3, 5, 8, 13 Output 2 Error, number should be greater than 3
Expert Answer:
Related Book For
Numerical Methods With Chemical Engineering Applications
ISBN: 9781107135116
1st Edition
Authors: Kevin D. Dorfman, Prodromos Daoutidis
Posted Date:
Students also viewed these computer network questions
-
What is the present value of $24463 that is to be received in 14 years time if you require a 8.2 percent return?
-
The Julian calendar was a reform of the Roman calendar introduced by Julius Caesar in 46 BC (708 AUC). It took effect in 45 BC (709AUC). It was the predominant calendar in most of Europe, and in...
-
(No program is required for this problem.) Simpson's rule for numerical integration [f(x)dx] approximates a function f(x) (blue curve in the figure) by a parabola, f(x) = ax + Bx+y, within two...
-
The best or alpha project managers spend more time on every process group than other project managers except for which one? A. initiating B. planning C. executing D. monitoring and controlling
-
It is observed that 66 28 Ni, with an atomic mass of 65.9291 u, decays by b- emission. (a) Identify the nucleus that results from this decay. (b) If the nucleus found in part (a) has an atomic mass...
-
Dynamic Services Inc. was organized on March 1, 2012, by two former college roommates. The corporation will provide computer tax services to small businesses. The following transactions occurred...
-
Use the Hillcrest Corporation data in Short Exercise 13-6 to compute Hilkest's a. Total liabilities b. Total assets Exercise 13-6 Hillcrest Corporation reported the following accounts: Prepare the...
-
Part 1: Calculate the companys Weighted Average Cost of Capital (30 marks) a) Calculate the before-tax cost of bank loans, mortgage loans, and corporate bonds (6 marks). b) Calculate the (market)...
-
How can organizations identify high performing employees and how can organizations effectively retain these employees? (250 words).
-
Imagine that the perfectly competitive market described in Chapter 7, Problem S1, was transformed into a pure monopoly. (What were formerly independent small firms are now production units owned by...
-
You are skiing down the slope of Mt. Aggie. Your path is described by equation: Y(X) = Acos(T) + A where d = 1000 and A = 300. Gravity (g) = 9.8 Velocity (tangential velocity) along the arc is simply...
-
Brand X is a popular clothing brand that has been in business for over a decade. In recent years, the brand has experienced a decline in sales and brand recognition. A new marketing team has been...
-
WHY is Rent Revenue accounted for under Other Income and Expense on the Income Statement?
-
What is the lamina propria and where is it located? Given thathigh number of eosinphils i the lamina propria suggests an allergicreaction, how might that lead to intestinal problems?
-
Great National Limited (GNL), is a multinational company with diverse product ranges and operating in many geographical markets. GNL is finalizing its financial statements for the year ended 30...
-
2. [3 pt] Solve the following recursion exactly by drawing a recursion tree. (You will need to give an exact explicit solution for 7). T(n) = T +T 1 (1/3)+ +n
-
The electrostatic charge density p(r) corresponding to the potential 19 1 ( 1 + /7) exp(-ar) 4TE ?" 2 is p = (a) q8(r)-2qa exp(-ar) (c) q8(r)-qexp(-ar) 2 (1) = (b) q8(r)-q. -exp(-ar) (d) -q8(r) - 2qa...
-
7 A 29-year-old, previously healthy man suddenly collapses at a party where legal and illicit drugs are being used. Enroute to the hospital, he requires resuscitation with defibrillation to establish...
-
Consider the Newtons method calculation of the roots of the nonlinear equation f (x) = x 3 . If the initial guess is x (0) = 2, what is x (1) ?
-
Answer the following questions about this code: (a) What mathematical problem is being solved? (b) What numerical method is used to solve the problem? (c) What is the significance of the value of n...
-
Determine the stability of the steady state solution of dy dt dy2 dt dy3 dt 2y1 + 2y2 + y3 3y1 + 2y2 + y3 = y1 + 2y2 + Y3
-
Write the equations of motion of a multidegree-of-freedom system in matrix form using a. the flexibility matrix, and b. the stiffness matrix.
-
Is the stiffness matrix \([k]\) always positive definite? Why?
-
What is a generalized mass matrix?
Study smarter with the SolutionInn App