//find fibonacci number for n times
#include<stdio.h>
int main()
{
int n, i = 0, j = 1, sum = 0, count;
printf("Enter a number which you want to find for fibonacci: ");
scanf("%d", &n); //input a number which is how many times u want find fibonnacci
printf("%d ", i);
printf("%d", j);
count = 2;
while(count < n)
{
sum = i+ j;
printf(" %d", sum);
i = j;
j = sum;
count++;
}
return 0;
}
#include<stdio.h>
int main()
{
int n, i = 0, j = 1, sum = 0, count;
printf("Enter a number which you want to find for fibonacci: ");
scanf("%d", &n); //input a number which is how many times u want find fibonnacci
printf("%d ", i);
printf("%d", j);
count = 2;
while(count < n)
{
sum = i+ j;
printf(" %d", sum);
i = j;
j = sum;
count++;
}
return 0;
}
very nice and maybe helpful. keep forward.
ReplyDeleteThanks Brother
Delete