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
-
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...
-
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
-
Retro reflection by transparent spheres, mentioned in Section 35.4 in the text, can be observed with dewdrops. To do so, look at the shadow of your head where it falls on dewy grass. Compare your...
-
Repeat the requirements of BE22-5 under the indirect method, assuming that Larrys Luggage Company reports under IFRS and begins the reconciliation to operating cash flows with income before interest...
-
Leicht Transfer & Storage provides warehousing services and often purchases pallets from Pallet Central. The companies followed a standard practice for documenting these transactions in which Pallet...
-
Boulanger Savings and Loan is proud of its long tra-dition in Winter Park, Florida. Begun by Michelle Boulanger 22 years after World War II, the S& L has bucked the trend of financial and liquidity...
-
Nirmo Power and Light has two P1,000 par value bonds outstanding. Bond X matures in five years and Bond Y matures in 15 years. Both bonds pay P80 interest annually and currently sell at their par...
-
The story behind your analysis of your forecast of the future based on your spreadsheet. Why did you choose the specific growth rates? What impact did they have on the value of Walmart? Use the...
-
What power does the Tenth Amendment give to the states? The power to withhold protective rights from the accused The power to guarantee liberties more fully than the federal government does The power...
-
3. Create a C program to read a positive integer n and to verify the mathematical expression: 1+3+5+ ... + (2n-1) = n Need to prove that the equation is valid for n = 1 For n = 1, we obtain [2(1) -...
-
What is the current International Funds Transfer threshold amount that should be reported on?
-
6. ABC Company has the following data: Operating Income $ 1,150,000 Total Assets $12,000,000 Current Liabilities $ 1,050,000 Sales $28,750,000 Target rate of return 9% Tax Rate 30% Weight Average...
-
The price elasticity of demand for your product is 5.0, and your marginal cost is $40. Your profit-maximizing price is $ (Round your answer to two decimal places.)
-
You manage a small motel that has 45 rooms, with an average room rate of $58 on a 76% occupancy rate. The hotel is open 365 days a year. Fixed costs are $480,000 and the VC per room sold is $8.00....
-
Complete the table below assuming the shrinkage= 18%, and determine the cost of any either waste or borrow volume if you know both cost about 16 US$ per yard, then plot the mass diagram on the...
-
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
-
A dump truck, whose bed is made of steel, holds an old steel watering trough. The bed of the truck is slowly raised until the trough begins to slide. What is the acceleration of the trough as it...
-
A vendor at the local art fair ties her tent to the concrete-filled coffee can shown in Figure P5.34. A stiff breeze comes up and the string becomes taut. What is the maximum value that the string...
-
The acceleration of the spacecraft in which the Apollo astronauts took off from the moon was 3.4 m/s 2 . On the moon, g = 1.6 m/s 2 .What was the apparent weight of a 75 kg astronaut during takeoff?
Study smarter with the SolutionInn App