C Program to generate Fibonacci Triangle

C Program to generate Fibonacci Triangle

C Program to generate Fibonacci Triangle:

In this program, we are getting input from the user for the limit for fibonacci triangle, and printing the fibonacci series for the given number of times (limit).

Let’s see the c example to generate fibonacci triangle.

#include<stdio.h>  

#include<stdlib.h>

int main(){

int a=0,b=1,i,c,n,j;

system(“cls”);

printf(“Enter the limit:”);

scanf(“%d”,&n);

for(i=1;i<=n;i++)

{

a=0;

b=1;

printf(“%d\t”,b);

for(j=1;j<i;j++)

{

c=a+b;

printf(“%d\t”,c);

a=b;

b=c;

 

}

printf(“\n”);

}

return 0;

}

Output:

Enter the limit:9
1
1	1	
1	1	2	
1	1	2	3	
1	1	2	3	5	
1	1	2	3	5	8	
1	1	2	3	5	8	13	
1	1	2	3	5	8	13	21	
1	1	2	3	5	8	13	21	34	

Enter the limit:5
1
1	1	
1	1	2	
1	1	2	3	
1	1	2	3	5		


 

Related Post:

Features of C Programming Language

Variables in C

Data Types in C

Keywords in C

C Operators

Comments in C

Escape Sequence in C

C Functions

Storage Classes in C

Dynamic memory allocation in C

Factorial Program in C

Leap year program in C

Fibonacci Series in C

Prime Number program in C

Palindrome program in C

Sum of digits program in C

Escape Sequence in C

ASCII value in C

Difference Between Type Casting and Type Conversion in C

Difference Between Variables and Constants

Matrix multiplication in C

C Program to generate Fibonacci Triangle

C Program to print “hello” without semicolon

C Program to swap two numbers without third variable

C Program to reverse number

Count the number of digits in C

Tokens in C

C Identifiers

C Strings

Compile time vs Runtime in C

C break statement

C goto statement

Type Casting in C

C String Functions

C Pointers

Dangling Pointers in C

void pointer in C

Pointer to Pointer in C

Recursion in C

Call by value and Call by reference in C

File Handling in C

C fprintf() and fscanf()

C fputc() and fgetc()

C fputs() and fgets()

C fseek() function

Constant Pointers in C

3 thoughts on “C Program to generate Fibonacci Triangle

  1. Pingback: Keywords in C - CloudNClear

  2. Pingback: Escape Sequence in C - CloudNClear

  3. Pingback: C Strings - CloudNClear

Comments are closed.