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


void main()
{
int i=1;
printf("%d%d%d",i,++i,i++);
}
Cau u say the output....?

Answers were Sorted based on User's Feedback



void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / shanthi

122

Is This Answer Correct ?    2 Yes 3 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / subash

221
because it starts executing from right to left
so it first executes i++(the increment will happen when
entire printf statement is executed so now ++i which means
it is the pre incremant so now i becomes 2

Is This Answer Correct ?    2 Yes 3 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / kiran

The output will be 1 2 2...
First the assigned value of i(1) is printed. Then (++i) prints the Incremented value of i which is 2 will be printed.
Now as the Postfix operator only prints thhe value first and then increments...so the value of i is again 2..

Is This Answer Correct ?    4 Yes 5 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / we r the new inventors

the explanation above are also correct but think they are somewhat wrong because it was post increment of i.so value of i will become 2..

Is This Answer Correct ?    1 Yes 2 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / we are the new inventors

above answers are also right but i think they are somewhat wrong..because its a post increment of i so ans will become 2...

Is This Answer Correct ?    0 Yes 1 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / sums

The ans is obv 3 3 1...
The explanations given are also correct
For all those u r giving other answers without even giving the reason should at least run the program in "gcc" before writing anything

Is This Answer Correct ?    2 Yes 4 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / sam

first the initial value of i is 1
i++ is post decremented so,i++ must be 1

final value is " 1 2 1"

Is This Answer Correct ?    1 Yes 3 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / ramya

OUTPUT:
1,2,1

Is This Answer Correct ?    0 Yes 2 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / pratik

answer is 1 1 2 ..
it is an example of stack type ..

Is This Answer Correct ?    0 Yes 4 No

void main() { int i=1; printf("%d%d%d",i,++i,i++); } Cau u say the output....?..

Answer / ismail ns

1 1 2

Is This Answer Correct ?    1 Yes 8 No

Post New Answer

More C C++ Errors Interview Questions

Write a c-programe that input one number of four digits and find digits sum?

2 Answers  


void main() { int i=7; printf("N= %*d",i,i); }

6 Answers   HCL,


Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has already been declared, use a do...while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .

2 Answers  


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

1 Answers  


Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;

3 Answers  


what is exceptions?

5 Answers   HCL, Wipro,


#include"stdio.h" #include"conio.h" void main() { int a; printf("\n enter a number:"); scanf("%c\n"); getch(); }

12 Answers   HCL,


To generate the series 1+3+5+7+... using C program

18 Answers  


what is syntax error?

3 Answers  


WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION void main() { int x=4,y=3,z; z=x-- -y; printf("%d%d%d",x,y,z); }

25 Answers   HCL,


when i use cout or cin call & then either << or >> .....it shows declaration syntax error...what should i do? cout<<"anything"; int a; cin>>a; return 0;

2 Answers  


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  


Categories