Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 / furquan

Here what happens is :

while(+(+i--)!=0)
i = 0
so 0 != 0 is false hence condition for while fails. Now
there is also a post decrement operator. So value of i turns
out to be -1. and that is which is printed.

Is This Answer Correct ?    6 Yes 0 No

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

Answer / rameshp

ans s -1

Bec

while(1!=0) this s false..so next line don't exec..

so i-- means 0--= -1

finally we get -1

Is This Answer Correct ?    6 Yes 1 No

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

Answer / priyadarshan kasta

-1.


i don't know why.

plz post the reason

Is This Answer Correct ?    3 Yes 1 No

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

Answer / rayan

ans is -1.

Initially i == 0, when it enters into while loop

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

in 1st iteration i value ll be 0 only due to post decrement
operator.

in second iteration as i gets its post decremented value n
becomes -1 & -1 ~= 0 condition gets true & while loop breaks.

here + operator in the loop is doing ntg.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

What is structure of c program?

0 Answers  


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

0 Answers   Genpact,


What is the output for the following program #include<stdio.h> main() { char a[5][5],flag; a[0][0]='A'; flag=((a==*a)&&(*a==a[0])); printf("%d\n",flag); }

5 Answers   ADITI, Wipro,


What is an array? What the different types of arrays in c?

0 Answers  


What is a nested loop?

0 Answers  


1 1 12 21 123 321 12344231 how i creat it with for loop??

1 Answers  


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

0 Answers  


What is an operator?

0 Answers  


With the help of using classes, write a program to add two numbers.

0 Answers   TCS,


What is fflush() function?

0 Answers  


what is the diff b/w static and non static variables in C. Give some examples plz.

3 Answers   Wipro,


what is the answer for it main() { int i; clrscr(); printf("%d",&i)+1; scanf("%d",i)-1; }

3 Answers  


Categories