fibonacci upto n-asr

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
int a=0,b=1,c=0,n;
    printf("Enter n");
scanf("%d",&n);
while(1){
 
    c=a+b;
     if(c>n){
        break;
    }
    printf("%d ",c);

    a=b;
    b=c;
 
}
    return 0;
}

Comments

Popular posts from this blog

aaabb to32 ,aabbb to a2b3 convert in c-asr

a2b3 output aabbb c program and beautiful use of getchar() ,isdigit() ,atoi() functions and stdlib.h header file-asr

C program to print square spiral number pattern - asr