#include<stdio.h>

int main()
{
int a=3,post,pre;
post= a++ * a++ * a++;
a=3;
pre= ++a * ++a * ++a;
printf("post=%d pre=%d",post,pre);
return 0;
}

Answers were Sorted based on User's Feedback



#include<stdio.h> int main() { int a=3,post,pre; post= a++ * a++ * a++; a=3; pre= ++a ..

Answer / linku

post=27 pre=216

Is This Answer Correct ?    11 Yes 4 No

#include<stdio.h> int main() { int a=3,post,pre; post= a++ * a++ * a++; a=3; pre= ++a ..

Answer / manish

post= a++ * a++ * a++;
a++ is post increment so 3*3*3=27 and then a is incremented

pre= ++a * ++a * ++a;

++a pre increment
consider ++a * ++a
a incremented two times first result is 5 => 5*5=25
now we have 25 * ++a (a is 5)
a is again incremented (a become 6)
25 * 6 =150 ans

Is This Answer Correct ?    7 Yes 1 No

#include<stdio.h> int main() { int a=3,post,pre; post= a++ * a++ * a++; a=3; pre= ++a ..

Answer / manish

post=27 pre=150

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More C Code Interview Questions

Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,


main() { int i=-1; -i; printf("i = %d, -i = %d \n",i,-i); }

1 Answers  


Write a program to model an exploding firecracker in the xy plane using a particle system

0 Answers   HCL,


void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }

1 Answers  


main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }

1 Answers  






How to swap two variables, without using third variable ?

104 Answers   AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,


find A^B using Recursive function

2 Answers  


Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcat(a,b)); } a. Hello b. Hello World c. HelloWorld d. None of the above

3 Answers   HCL,


void main() { int c; c=printf("Hello world"); printf("\n%d",c); }

2 Answers  


#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }

3 Answers  


main() { printf("%x",-1<<4); }

3 Answers   HCL, Sokrati, Zoho,


Categories