Sunday, March 19, 2023

"print the fibonacchi series using c'' in c

 //print the fibonacchi series using c

#include <stdio.h>
int main (){
    int num1=0,num2=1,num3,i,upto;
    printf ("series will go upto :");
    scanf ("%d",&upto);
    printf ("%d %d ",num1,num2);
    for (i=2;i<upto;i++){
        num3=num1+num2 ;
        printf ("%d ",num3);
        num1=num2;
        num2=num3;
    }
    return 0;
}

OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT OUTPUT

series will go upto :15 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377

No comments:

Post a Comment

print a multiplication table of any integer taking from user

 // print a multiplication table of any integer taking from user  #include "stdio.h" int main () { int n,mul,i; printf ("...