Search This Blog
Welcome to 1printf(), your ultimate destination for C, C++, Linux, Data Structures, and Microcontroller programming! ๐ ๐นLearn advanced coding techniques in C& C++ ๐นMaster Linux internals & shell scripting ๐นDeep dive into Data Structures & Algorithms ๐นExplore Embedded Systems & Microcontrollers (8051,UART, RTOS) ๐นGet hands-on coding tutorials, project ideas,and interview preparation tips Whether you're a beginner or an experienced programmer, this channel will help you
Featured
- Get link
- X
- Other Apps
C Program to Print Fibonacci Series Up To N
✅ C Program to Print Fibonacci Series Up To N
#include <stdio.h>
int main()
{
int num,a=0,b=1,c;
printf("Enter the limit:\n");
scanf("%d",&num);
printf("Fibonacci series upto %d\n",num);
while(a<=num)
{
printf("%d ",a);
c=a+b;
a=b;
b=c;
}
}
๐ Explanation:
This program prints the Fibonacci series up to a given limit using a while loop. In Fibonacci series, each number is the sum of the previous two numbers.
- Initialize first two numbers as
a = 0andb = 1. - Print
awhile it is less than or equal to the limit. - Calculate next term using
c = a + b. - Update values:
a = bandb = c. - Repeat until
a <= num.
๐งพ Sample Output:
Enter the limit: 20 Fibonacci series upto 20 0 1 1 2 3 5 8 13
๐ Keywords:
C program Fibonacci series, Fibonacci series in C, C loop programs, while loop example in C, beginner C programs, Fibonacci logic explanation
๐ Hashtags:
#CProgramming #Fibonacci #LearnC #CodingForBeginners #WhileLoop #1printf
๐ Search Description:
Learn how to print Fibonacci series in C up to a given number using while loop. Simple beginner-friendly program with explanation and sample output.
Popular Posts
C++ Program for Hybrid Inheritance (All Types Together)
- Get link
- X
- Other Apps
C++ Program for Function Overloading Example
- Get link
- X
- Other Apps
Comments
Post a Comment