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;
}
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
Post a Comment