25 votes 25 votes Consider the following C program. #include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n--; --n1; n-=n1; printf(“%d”, n); return 0; } The output of the program is ______ Programming in C gatecse-2017-set2 programming-in-c numerical-answers easy + – Madhav asked Feb 14, 2017 • edited Dec 26, 2023 by Hira Thakur Madhav 12.0k views answer comment Share Follow See 1 comment See all 1 1 comment reply Arrick commented Feb 19, 2017 reply Follow Share #include<stdio.h> int main () { int m=10; \\m=10 int n, n1; n=++m; \\n=11,m=11 n1=m++; \\n1=11,m=12 n--; \\n=10 --n1; \\n1=10 n-=n1; \\n=10-10=0 printf(“%d”, n); \\0 return 0; } output is 0. 6 votes 6 votes Please log in or register to add a comment.
Best answer 35 votes 35 votes $m = 10; \quad \; \qquad \qquad \overset{m}{\boxed{10}}$ $n=\text{++}m; \qquad\qquad \overset{n}{\boxed{11}} \quad\overset{m}{\boxed{11}}$ $n1=m\text{++}; \; \;\quad \qquad \overset{n1}{\boxed{11}} \quad\overset{m}{\boxed{12}}$ $n\text{ --}; \; \; \;\qquad \qquad \qquad \overset{n}{\boxed{10}}$ $\text{-- }n1; \;\qquad \qquad \qquad \overset{n1}{\boxed{10}}$ $n\text{ -= }n1; \; \;\;\; \qquad \qquad \overset{n}{\boxed{0}} \quad(\because n = n-n1 = 10-10=0)$ So, printf("%d", n); // prints 0. Hence, answer is 0. Arnabi answered Feb 14, 2017 • edited Jan 14, 2023 by shadymademe Arnabi comment Share Follow See all 0 reply Please log in or register to add a comment.
11 votes 11 votes 0 is answer Prashant. answered Feb 14, 2017 Prashant. comment Share Follow See all 0 reply Please log in or register to add a comment.
7 votes 7 votes yes correct ans is 0 2018 answered Feb 14, 2017 2018 comment Share Follow See all 0 reply Please log in or register to add a comment.
4 votes 4 votes Final answer is expected to be zero. Correct me if i am wong!! swap_it answered Feb 14, 2017 swap_it comment Share Follow See all 0 reply Please log in or register to add a comment.