Questions


September 2021 1 34 Report


Question: A Funny Series

Consider a sequence of the form 0, 1, 1, 2, 4, 7, 13, 24, 44, 81, 149…

Write a method Met which takes as parameter an integer n and prints the nth term of the above sequence. The nth term will fit in an integer value.

Hint: Does this pattern look familiar? Remember the logic for Fibonacci series?

Only write the method - assume that the Main class & main method have been defined.

Example Input: 5
Output: 4
Example Input: 8
Output: 24
Example Input: 11
Output: 149

Answers & Comments


Add an Answer


Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Helpful Social

Copyright © 2024 EHUB.TIPS team's - All rights reserved.