2 2 votes Consider the following C code: include <stdio.h> int fun() { static int num=25; return num--; } int main() { for(fun( ); fun();fun()) printf("%d", fun( )); return O; } The sum of the values printed by the above program will be Programming in C programming programming-in-c made-easy-test-series + – Ram Swaroop 2.2k views answer comment Share Follow Print See all 3 Comments 3 3 Comments reply OneZero commented Jan 29, 2019 reply Follow flag 100? 1 1 replyShare Ram Swaroop commented Jan 29, 2019 reply Follow flag yes 100 how to solve these types of questions 1 1 replyShare Harshit_Tiwari_Pali commented Feb 12, 2019 reply Follow flag first time when for loop is executed it become 1. for(fun=25;fun()//here decrement will take place so now value is 24;fun()) printf ("%d",fun() //here decrement will take place so now value is 23) 2. now condition check so value become 22 3 now again for loop for(fun=22;fun() //here decrement will take place so now value is 21; fun()) printf ("%d",fun() //here decrement will take place so now value is 20) nd so on 0 0 replyShare Please log in or register to add a comment.
1 1 vote It won't do anything , it will have compilation error. Used : instead of ; If we consider it without errors , equivalent while loop can be written as :- fun(); //initialization while(fun()//termination condition when fun() gets 0) { print("%d",fun()); fun(); } which will print :- 2320171411852 prashant jha 1 answered Jan 29, 2019 prashant jha 1 comment Share Follow See all 3 Comments 3 3 Comments reply balchandar reddy san commented Jan 29, 2019 reply Follow flag But we are performing 4 fun() in each iteration..so the sequence should be 22,18,14,10,6,2, right? 0 0 replyShare prashant jha 1 commented Jan 29, 2019 reply Follow flag 4 . How? initialization happens only once in for loop 0 0 replyShare Ashutosh777 commented Jul 16, 2020 reply Follow flag https://gateoverflow.in/302821/gate2019-27 0 0 replyShare Please log in or register to add a comment.