not able to understand the problem
Fibonacci problem 4 not able to understand the problem
hi @shivamraj53.sr
In Pattern Question, there is a common method which we teach in course viz, taking nsp, nst, csp, cst and row variables.
Pattern Hack : Always first Try to first print pattern by ignoring the value to be printed then accommodate your value in that pattern. For e.g.,
0
1 1
2 3 5
8 13 21 34
View it as:-
*
* *
* * *
* * * *
``
`` Short Info about the variables:-
1. nsp (number of spaces)-> Number of spaces in very First Line of the pattern.
2. nst (number of stars)-> Number of stars in very first line of the pattern.
3. csp (counter of spaces)-> counter of spaces that will print the required number of spaces and will be initialized with 1 and incremented upto nsp.
4. cst (counter of stars)-> counter of spaces that will print the required number of stars and will be initialized with 1 and incremented upto nst.
5. rows -> It will be initialized with 1 and will go upto the total number of rows in the pattern.
In Given, pattern no spaces are there only stars are present.
nst = 1, cst = 1, rows = 1, total rows = n;
The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ………
In this sequence a fibonacci number is calculated as sum of the previous two fibonacci numbers.Here 0th fibonacci is 0 and 1stfibonacci is 1.
In the given pattern each number is separated from other by a tab. For given input n, You need to print n(n+1)/2 fibonacci numbers i.e. Kth row contains , next k fibonacci numbers.
refer this code -->
thanks for the guidance
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.