Given a number ‘n’, write a function that prints the last two digits of n-th (‘n’ can also be a large number) Fibonacci number.
Input : n = 65 Output : 65 Input : n = 365 Output : 65
Recommended: Please solve it on “PRACTICE” first, before moving on to the solution.
A simple solution is to find n-th Fibonacci number and print its last two digit. But N can be very large, so it wouldn’t work.
A better solution is to use the fact that after 300-th Fibonacci number last two digits starts repeating.
1) Find m = n % 300.
2) Return m-th Fibonacci number.
1 61 13 53
- Program to find Nth odd Fibonacci Number
- Finding number of digits in n'th Fibonacci number
- Find the average of k digits from the beginning and l digits from the end of the given number
- Python Program for n-th Fibonacci number
- C/C++ Program for nth multiple of a number in Fibonacci Series
- Find the next fibonacci number
- Find the Largest number with given number of digits and sum of digits
- Find the previous fibonacci number
- Find nth Fibonacci number using Golden ratio
- Find Index of given fibonacci number in constant time
- Program to find last two digits of 2^n
- Program to find the last two digits of x^y
- Check if a M-th fibonacci number divides N-th fibonacci number
- Find count of digits in a number that divide the number
- Find maximum number that can be formed using digits of a given number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.