void main()
{
static int i;
while(i<=10)
(i>2)?i++:i--;
printf(“%d”, i);
}
Answers were Sorted based on User's Feedback
Answer / susie
Answer :
32767
Explanation:
Since i is static it is initialized to 0. Inside the while
loop the conditional operator evaluates to false, executing
i--. This continues till the integer value rotates to
positive value (32767). The while condition becomes false
and hence, comes out of the while loop, printing the i value.
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / prashanth
As i is static, it initially stores value 0.
as 0<=10 and in next stmt 0>2 is false so i-- is executed..
the loop continues till i=-32768 and when i=-32768 then
-32768>2 is false so i-- is executed..
As -32768-1 is equal to 32767. so i=32767 now..
while condition fails and it comes out of loop..
so the ans. is 32767.
| Is This Answer Correct ? | 4 Yes | 0 No |
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }
C program to print magic square of order n where n > 3 and n is odd
#define a 10 void foo() { #undef a #define a 50 } int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } explain the answer
main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }
How can you relate the function with the structure? Explain with an appropriate example.
main() { char *p; int *q; long *r; p=q=r=0; p++; q++; r++; printf("%p...%p...%p",p,q,r); }
given integer number,write a program that displays the number as follows: First line :all digits second line : all except the first digit . . . . Last line : the last digit
# include <stdio.h> int one_d[]={1,2,3}; main() { int *ptr; ptr=one_d; ptr+=3; printf("%d",*ptr); }
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
main() { if (!(1&&0)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above
Write a C function to search a number in the given list of numbers. donot use printf and scanf