what is the code of the output of print the 10 fibonacci
number series
Answers were Sorted based on User's Feedback
Answer / arun asokan
#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,limit=8;
clrscr();
printf("%d\t%d",a,b);
for(n=1;n<=limit;n++)
{
c=a+b;
a=b;
b=c;
printf("\t%d",c);
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / prassatharun
#include<stdio.h>
void main()
{
int a=0,b=1,c,limit=10,n=1;
clrscr();
printf("%d\n%d",a,b);
while(n<=limit)
{
c=a+b;
a=b;
b=c;
printf("\n%d",c);
n++;
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 2 No |
main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }
main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
#include<stdio.h> void fun(int); int main() { int a; a=3; fun(a); printf("\n"); return 0; } void fun(int i) { if(n>0) { fun(--n); printf("%d",n); fun(--n); } } the answer is 0 1 2 0..someone explain how the code is executed..?
what is the code of the output of print the 10 fibonacci number series
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);
main() { int i =0;j=0; if(i && j++) printf("%d..%d",i++,j); printf("%d..%d,i,j); }
int swap(int *a,int *b) { *a=*a+*b;*b=*a-*b;*a=*a-*b; } main() { int x=10,y=20; swap(&x,&y); printf("x= %d y = %d\n",x,y); }
write a origram swaoing valu without 3rd variable
main() { extern int i; i=20; printf("%d",i); }