main()

{

int i=0;

while(+(+i--)!=0)

i-=i++;

printf("%d",i);

}

Answers were Sorted based on User's Feedback



main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / susie

Answer :

-1

Explanation:

Unary + is the only dummy operator in C. So it has no effect
on the expression and now the while loop is, while(i--!=0)
which is false and so breaks out of while loop. The value –1
is printed due to the post-decrement operator.

Is This Answer Correct ?    75 Yes 2 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / govind verma

output will be -1.... because inwhile +(+i--)!=0 () have higher precedence then control goes to in parenthses and unary plus and ++ have the same precedece in table then we chek the associativty which is right to left i++ is evaluate first then the value of i will not chang withn a same expression because its a post fix increment now expression become +(+0)!=0 and unary plus have no effect then expression look lyk 0!=0 this condition is false then while block of code will not execute and nw i become -1 and we try to print like this printf("%d",-1); then output will -1

Is This Answer Correct ?    9 Yes 2 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / mohamedsalman s

-1

Is This Answer Correct ?    6 Yes 0 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / lavanya

-1

Is This Answer Correct ?    4 Yes 0 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / venkatesh

-1

Is This Answer Correct ?    1 Yes 0 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / babu

1

Is This Answer Correct ?    2 Yes 2 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / ram

i think it is -1

Is This Answer Correct ?    1 Yes 1 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / prem

0

Is This Answer Correct ?    1 Yes 6 No

main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }..

Answer / akshata

0

Is This Answer Correct ?    2 Yes 11 No

Post New Answer

More C Code Interview Questions

prog. to produce 1 2 3 4 5 6 7 8 9 10

4 Answers   TCS,


Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?

2 Answers  


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

11 Answers   Deshaw, Infosys,


Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.

1 Answers   Samar State University,


¦void main() ¦{ ¦int i=10,j; ¦ j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-30 but in same question if we write as- ¦void main() ¦{ ¦int i=10; ¦ int j=i+++i+++i; ¦printf("%d",j); ¦getch(); ¦} ¦ output:-33 why output is changed from 30 to 33. Can any body answer...

3 Answers  






void main() { while(1){ if(printf("%d",printf("%d"))) break; else continue; } }

1 Answers  


In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

0 Answers   TCS,


What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }

1 Answers  


Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all.

2 Answers   Mentor Graphics, Microsoft,


Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??

0 Answers   Home,


write a program for area of circumference of shapes

0 Answers  


Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false

1 Answers   Cognizant, lenovo,


Categories