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
- Finding number of digits in n'th Fibonacci number
- Python Program for n-th Fibonacci number
- Find the Largest number with given number of digits and sum of digits
- C/C++ Program for nth multiple of a number in Fibonacci Series
- 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
- Check if a M-th fibonacci number divides N-th fibonacci number
- Find the smallest number whose digits multiply to a given number n
- Find count of digits in a number that divide the number
- Find maximum number that can be formed using digits of a given number
- Find first and last digits of a number
- Given a number n, find the first k digits of n^n
- Write a program to reverse digits of a number
- Program to check if a given number is Lucky (all digits are different)
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.