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 |
what is the output of the below program & why ? #include<stdio.h> void main() { int a=10,b=20,c=30; printf("%d",scanf("%d%d%d",&a,&b,&c)); }
Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..
what is the output of following program ? void main() { int i=5; printf("%d %d %d %d %d ",i++,i--,++i,--i,i); }
how to swap 3 nos without using temporary variable
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }
How to read a directory in a C program?
What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;
WAP to display 1,2,3,4,5........N
write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .
Write a program to model an exploding firecracker in the xy plane using a particle system
How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }