Skip to main content

Featured

C Pattern Programs: Square Number and Alphabet Patterns Explained

πŸ”· Square Star Pattern πŸ“‹ Copy Code #include <stdio.h> int main() { int num; printf("Enter the number:\n"); scanf("%d", &num); for(int i = 1; i <= num; i++) { for(int j = 1; j <= num; j++) { printf("* ");//keep"* " } printf("\n"); } return 0; } πŸ”· Reverse Square Alphabet Pattern (Column-wise) πŸ“‹ Copy Code #include <stdio.h> int main() { int num; printf("Enter the number:\n"); scanf("%d", &num); for(int i = num; i >= 1; i--) { for(int j = num; j >= 1; j--) { printf("%c ", j + 64);//%c for Character and 64 will be ASIIC VALUE } printf("\n"); } return 0; } πŸ”· Reverse Square Alphabet Pattern (Row-wise) πŸ“‹ Copy Code #include <stdio.h> int main() { int num; ...

C Program to Print Fibonacci Series Up To N

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 = 0 and b = 1.
  • Print a while it is less than or equal to the limit.
  • Calculate next term using c = a + b.
  • Update values: a = b and b = 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.

Comments

Popular Posts

πŸŒ™