write a program for fibonaci series by using while loop in c?
Answers were Sorted based on User's Feedback
Answer / rajendra raji
main()
{
int a=0,b=1,c,n;
printf("enter n value");
scanf("%d",&n);
Printf("%d%d",a,b);
n=n-2;
while(n>0)
{
c=a+b;
printf("%d",c);
a=b;
b=c;
n--;
}
}
Explanation:
Hi....
if you give n value as 5, then it will print 5 values including the first printed a and b values..!!
try it once.. it will definitely work..
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / shamantha
main()
{
int a=0,b=1,c,n;
printf("enter n value");
scanf("%d",&n);
Printf("%d%d",a,b);
while(n-2>0)
{
c=a+b;
printf("%d",c);
a=b;
b=c;
n=n+1;
}
}
| Is This Answer Correct ? | 1 Yes | 2 No |
What is the use of sizeof?
write a programe returns the number of times the character appears in the string
#include<stdio.h> main() { int a=1; int b=0; b=++a + ++a; printf("%d %d",a,b); }
what is function pointer?
f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?
How many levels of pointers can you have?
why the execution starts from main function
how many key words availabel in c a) 28 b) 31 c) 32
write a program to display all prime numbers
Did c have any year 2000 problems?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What is the use of clrscr?