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...


#include<stdio.h>
void main()
{
int i=1;
printf("%d%d%d",i++,++i,i);
}

Answers were Sorted based on User's Feedback



#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / smriti

ans is 2 2 1.printf gets exe from rit to left so i =1,++i is 2,den i++ is 2 ..values are pushed into stack frm rit to left..so in stack 1 gets pushed first den 2 den 2.while pop d result is 2 2 1.

Is This Answer Correct ?    0 Yes 0 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / vinod

3 2 1.because the print f function print right to leftand
the compiler reads left to right.thus answer is 3 2 1

Is This Answer Correct ?    0 Yes 0 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / shruti

the answer will be:-
1,3,3
as i++ is postfix so first it will print the value then
increament..
after first increament the second preincreament comes and
the value becomes 3..
third time also it will 3..

Is This Answer Correct ?    4 Yes 5 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / rakesh

getch();-missing

Is This Answer Correct ?    0 Yes 1 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / kamal

211

Is This Answer Correct ?    0 Yes 2 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / aaradhana

1,2,2

since to print the postincremented value then i takes the
value 1 then gets preincremented by1 & takes i=2.To print i
value then it takes the updated value i=2.

Is This Answer Correct ?    1 Yes 3 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / kiran123456789

3 2 1

Is This Answer Correct ?    1 Yes 3 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / ramya

Answer is 133.
first the compiler prints 'i' value and prints the value,
next it increments the 'i' value and then prints its value.

Is This Answer Correct ?    8 Yes 14 No

#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }..

Answer / priyadarshan kasta

1 2 2

becoz, this line will execute frm right to left side.
that is, first i=1, then ++i will be 2 and then i++ will be
printed as 2. So , it will print as 1 2 2(i.e i++,++i,i)

Is This Answer Correct ?    1 Yes 10 No

Post New Answer

More C C++ Errors Interview Questions

write a profram for selection sort whats the error in it?

2 Answers  


How to develop a program using C language to convert 8-bit binary values to decimals. TQ

1 Answers   Amazon,


What is the code for following o/p * * * * * * * * * * * * * * * *

1 Answers  


void main() { int i=5; printf("%d",i+++++i); }

14 Answers   HCL,


#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }

19 Answers  


what is meant for variable not found?

3 Answers  


How to create a program that lists countries capitals when country is entered? (Terribly sorry, I'm a complete novist to coding with C, am looking for inspiration and general tips on how to code and create this program.)

0 Answers  


How to convert hexadecimal to binary using c language..

1 Answers   Bajaj, GAIL, Satyam, Zenqa,


Given that two int variables, total and amount , have been declared, write a sequence of statements that: initializes total to 0 reads three values into amount , one at a time. After each value is read in to amount , it is added to the value in total (that is, total is incremented by the value in amount ). Instructor's notes: If you use a loop, it must be a for loop. And if you use a loop control variable for counting, you must declare it.

1 Answers   Google,


Given an int variable n that has been initialized to a positive value and, in addition, int variables k and total that have already been declared, use a do...while loop to compute the sum of the cubes of the first n whole numbers, and store this value in total . Thus if n equals 4, your code should put 1*1*1 + 2*2*2 + 3*3*3 + 4*4*4 into total . Use no variables other than n , k , and total .

3 Answers  


void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....

2 Answers  


main() { char c; for(c='A';c<='Z';c++) getch(); }

9 Answers  


Categories