#include <stdio.h> #define F(a,b) (a*b) / (a-b) int main () { int a = 20, b = 10; printf("%d\n", F(a-1, b+2)); return 0; } // What's the output ? [Do not execute / run] // Source : http://www.youngprogrammer.com/

Advertisements

#include <stdio.h> #define F(a,b) (a*b) / (a-b) int main () { int a = 20, b = 10; printf("%d\n", F(a-1, b+2)); return 0; } // What's the output ? [Do not execute / run] // Source : http://www.youngprogrammer.com/

Advertisements

%d bloggers like this:

a*b=12 but i am having a-b=11

whats the problem?

thanks.

@md. ashiqul mostofa

u r having a – b = 11

becoz it’s the correct ans

what do u think the value was supposed to be ?

lets make it clr

suppose line : 2 is written as,

#define F(A,B) A-B

Now, A = a – 1

and B = b + 2

A – B = a – 1 – b + 2 = 20 – 1 – 10 + 2 = 11