Fibonacci Series Program in C | C Language Tutorial | Mr. Srinivas

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] however welcome to nourish technologies this is in verse in this session we are going to discuss one logical program in C so that is how to print Fibonacci series right using C language syntax here the concept of printing the Fibonacci series so what is the easy way of printing Fibonacci series so first of all what is that Fibonacci series see for example here series will see is a 0 and 1 and add these two subsequent values if you add head 0 n 1 is the next next number next element and 1 plus 1 is it 2 1 plus 2 is a 3 2 plus 3 is a 5 3 plus 5 is a 8 5 plus 8 is a 13 this is the Fibonacci series now how to write the program for this but generally how they will ask means what print n elements in the series first n elements in the Fibonacci series so here it is the easiest way here it is so directly I am starting from the main function the first we need to ask the limiters in in sameen's printf enter limit how many how many numbers how many elements we need to print in the fable of the cells and here it is enter limit and they will give that n value and value so that we are reading the percentage D and C just consider n value and value is 7 so first take two elements nothing but first two numbers first two elements in the series in two variables a equals to zero D equals to 1 and C so one like a temporary variable always we need to print that a value a value so here we are repeating the loop this I value starts from 1 to how many elements you need to print in the series those many times you have to repeat the loop so I value starts from 1 I is less than or equals to N plus plus first of all directly print a value printf percentage D is a print a value so what is that a value initially we took zero so in the output in the output first it will bring zero so here a value is zero B value is 1 and C is equals to so first what operation we have to perform means just add a and B and store the value into C and a and B a plus B and the value we are storing into see see look at this the value a value 0 the B value 1 0 plus 1 is a 1 will be stored in 2 C after that after printing 0 the next number the B value we should store into a and C value we should store in to be this process will continue this process look at this here it is the B value we are storing we are storing into a and C value we are storing into B so this is the process right user to print that Fibonacci series see next time so I value become 1 so 1 is less than or equals to 7 condition true it will print that a value C now look at this whenever you are placing B value here a value is 1 and the C value into B means what it is also 1 now look at this if you print a value what is that a value second iteration 1 it will print is nothing but 1 next here it is the same iteration we need to add a plus B the value will be stored in to see the a plus B 1 plus 1 the value will be stored in to see after that B value we are storing into a C value we are storing in to be first B value we are storing into a what is the B value 1 and the C value we are storing in to be it said - and next number we are printing what is the next number in the series a value we are printing always so this process will continue now observe one plus two C value is three next B value will be stored into a what is that B value is 2 and what is that C value is 3 so next number in the series - it will print next 2 plus 3 is a 5 and X I'm sorry 3 will come to here and 5 will come to here and it will print 3 and next three plus five is eight same again 5 will come to here and 8 will come to hear it here it is a 5 plus 8 value is a 13 next 8 will come to here 13 will come to here so like that it will go so in the series is we are looking for first 7 elements see these are the first seven elements 2 3 5 8 this is how to print n elements in the Fibonacci series program using C language index okay so hope you understood for more videos please subscribe to nourish our channel thank you thank you [Music] hmm
Info
Channel: Naresh i Technologies
Views: 771,902
Rating: 4.8868451 out of 5
Keywords: Fibonacci, Fibonacci Series, Fibonacci Series Program, C Language Tutorial, Srinivas, fibonacci series, fibonacci sequence, fibonacci number, numbers
Id: XH104T-Zeo0
Channel Id: undefined
Length: 5min 54sec (354 seconds)
Published: Wed Apr 12 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.