Computing the Fibonacci Sequence | C Programming Example

  Рет қаралды 12,230

Portfolio Courses

Portfolio Courses

Күн бұрын

Пікірлер: 12
@justcurious1940
@justcurious1940 10 ай бұрын
Thanks for the explanation , Recursion is hard for new programmers : // Iterative solution void Fibonacci_Iterative (int Sequence_Length){ int first = 0, second = 1, third; printf("%d,%d,",first,second); for(int i = 2 ; i < Sequence_Length ; i++){ third = first + second; printf("%d",third); first = second; second = third; if(i != Sequence_Length-1) printf(","); else printf(" "); } } // Recursive solution int Fibonacci_Recursion(int Position){ if(Position > 1) return Fibonacci_Recursion(Position - 1) + Fibonacci_Recursion(Position - 2); if(Position == 0) return 0; if(Position == 1) return 1; printf("Invalid position !! "); return -1; }
@chal7z
@chal7z 11 ай бұрын
you're such a great teacher !. Your videos are really helpful, tysm!!
@maniyaa_
@maniyaa_ 2 жыл бұрын
Great video! thank you for the clear and logical explanation :)
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You’re welcome Marley! :-)
@miarayokik.s.h8941
@miarayokik.s.h8941 2 жыл бұрын
Ooooh that's really understandable... Thank youuuuu 💕
@PortfolioCourses
@PortfolioCourses 2 жыл бұрын
You’re welcome! :-)
@chinni949
@chinni949 3 ай бұрын
sir are these programs helpful for campus recruitments
@abdoTheDS
@abdoTheDS 2 ай бұрын
anyone that did not get how that recursion function works. use a pen and paper ✅
@rakshaya518
@rakshaya518 4 ай бұрын
Not working for 48 the values are going in negative
@PortfolioCourses
@PortfolioCourses 4 ай бұрын
At a certain point the number is so big that it essentially can’t be represented accurately by the type. If you change the type to size_t it should work for larger numbers as size_t can represent a larger range of positive integer values.
@Abdalrahman_0
@Abdalrahman_0 Жыл бұрын
I think that I did it better void fun (int x){ int y= x, i ; printf("%d ", x); printf("%d ", x+=1); for(i = 0;i < 10;i++){ y= (x+y); printf("%d ", y); x= (x+y); printf("%d ", x); } } ------------->The main int main(void) { int x; printf("Enter a #: "); scanf("%d", &x); fun(x); return 0; } + Thank u so much❤❤
@PortfolioCourses
@PortfolioCourses Жыл бұрын
Thanks for sharing your solution! :-)
Counting the Vowels in a String | C Programming Example
9:50
Portfolio Courses
Рет қаралды 17 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 56 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 19 МЛН
Why is Python 150X slower than C?
10:45
Mehul - Codedamn
Рет қаралды 30 М.
Infinite Input Buffer | C Programming Example
13:08
Portfolio Courses
Рет қаралды 16 М.
String Format Validation | C Programming Example
8:36
Portfolio Courses
Рет қаралды 8 М.
Create a copy of an array | C Programming Example
11:33
Portfolio Courses
Рет қаралды 8 М.
Convert binary to decimal | C Programming Example
9:06
Portfolio Courses
Рет қаралды 13 М.
Reverse The Words In A String | C Programming Example
6:18
Portfolio Courses
Рет қаралды 27 М.
Vector Addition | C Programming Example
5:41
Portfolio Courses
Рет қаралды 10 М.
Reverse An Array | C Programming Example
7:34
Portfolio Courses
Рет қаралды 35 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 56 МЛН