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 |
write a program to read a number and print in words that is in sentence for example 21,219 then output is "twenty one thousand and two hundred nineteen" by using only control flow statements (only loops and switch case )?
What is variable declaration and definition in c?
a=5 a=a++/++a
Can you think of a way when a program crashed before reaching main? If yes how?
to get a line of text and count the number of vowels in it
a character variable can at a time store a) 1 character b) 8 characters c) 254 characters d) none of the above
What is Conio.h ?
Differentiate between ordinary variable and pointer in c.
What is logical error?
what is the diff between the printf and sprintf functions?? and what is the syntax for this two functions ??
What is the use of the sizeof operator?
Explain the process of converting a Tree into a Binary Tree.