#include<stdio.h>
int main()
{
int i=2;
int j=++i + ++i + i++;
printf("%d\n",i);
printf("%d\n",j);
}

Answers were Sorted based on User's Feedback



#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / manjunath.b.a

i=5
j=12

Is This Answer Correct ?    1 Yes 1 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / vivek patel

it give warning...........

because fun should have return type...

first i=2

then ++i so i=3 and j=3+ ++i + i++
then ++i so i=4 and j=3 + 4 + i++;
then i++ so i=5 and j=3 + 4+ 5;
so i=5 and j=12;

there is no more diff between i++ and ++i in run time..
it gives same ans....

Is This Answer Correct ?    3 Yes 3 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / ashok reddy

intially i=2
j=++i + ++i + i++;
in this statament it calculates from r-l
so j=5+4+2
and the last value of i is 5
so i=5 and j=11
is the correct answer

Is This Answer Correct ?    0 Yes 0 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / barathi

i=2
j=9

Is This Answer Correct ?    0 Yes 0 No

#include<stdio.h> int main() { int i=2; int j=++i + ++i + i++; printf("%d\n&qu..

Answer / nb

i = 2 (i dont change)
j = 6 (++i = 3 and in i++ increments after calculating j )

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More C Interview Questions

How to receive strings with spaces in scanf()

7 Answers  


how to build a exercise findig min number of e heap with list imlemented?

0 Answers  


what is the different bitween abap and abap-hr?

0 Answers   TCS,


What does the error 'Null Pointer Assignment' mean and what causes this error?

0 Answers   TISL,


how the size of an integer is decided? - is it based on processor or compiler or OS?

19 Answers   HCL, JPR, Microsoft, nvidia,






Explain what are bus errors, memory faults, and core dumps?

0 Answers  


Write a C program that computes the value ex by using the formula ex =1+x/1!+x2/2!+x3+3!+………….

1 Answers  


#include <stdio.h> int main() { if ("X" <"x") printf("X smaller than x "); } my question is whats the mistake in this program? find it and please tell me..

3 Answers  


What will be the output of following program #include main() { int x,y = 10; x = y * NULL; printf("%d",x); }

1 Answers  


Why is struct padding needed?

0 Answers  


what is the difference between entry control and exit control statement?

12 Answers   Darbari Lal DAV Model School,


Program to swap the any two elements in an array containing N number of elements?

1 Answers   Bosch, Glenwood, Ugam Solutions,


Categories