#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

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

1 Answers  


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

6 Answers   HCL,


class test { int a; public: test(int b):a(b){} void show(){ cout<<a; } }; void main() { test t1; test t2(5); t1.show(); t2.show(); } }

1 Answers  


loop1: { x=i<n?(i++):0; printf("%d",i); exit(x); continue; } Error- misplaced continue. Doubt-1.will the exit(x) be executed for all values of x 2.will this statement go out of the program.

5 Answers   CMC,


Assume that the int variables i and j have been declared, and that n has been declared and initialized. Write code that causes a "triangle" of asterisks of size n to be output to the screen. Specifically, n lines should be printed out, the first consisting of a single asterisk, the second consisting of two asterisks, the third consistings of three, etc. The last line should consist of n asterisks. Thus, for example, if n has value 3, the output of your code should be * ** *** You should not output any space characters. Hint: Use a for loop nested inside another for loop.

2 Answers   HCL,






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

2 Answers  


which typw of errors ? & how to solve it ?

0 Answers  


UINT i,j; i = j = 0; i = ( i++ > ++j ) ? i++ : i--; explain pls....

5 Answers  


what is macro in c? Difference between single linked list & double linked list what is fifo & lifo? what is stack & queue?

2 Answers   TCS,


Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly

1 Answers   AMA,


quoroum of computer languages?

0 Answers   Infosys,


What is the out put of this programme? int a,b,c,d; printf("Enter Number!\n"); scanf("%d",&a); while(a=!0) { printf("Enter numbers/n"); scanf("%d%d%d",&b,&c,&d); a=a*b*c*d; } printf("thanks!"); getche(); Entering numbers are a=1,b=2,c=3,d=4 b=3,c=4,d=-5 b=3,c=4,d=0

5 Answers   TCS,


Categories