0 votes 0 votes What will be the answer to this question ? Will it go in infinite loop ? Digital Logic usergate2019 usermod + – Nandkishor3939 asked Feb 4, 2019 Nandkishor3939 1.3k views answer comment Share Follow See all 14 Comments See all 14 14 Comments reply Hemanth_13 commented Feb 4, 2019 reply Follow Share Marked it as binary number regerator which terminates.. hoping it to be correct :) 0 votes 0 votes Duffer commented Feb 4, 2019 reply Follow Share It will run into an infinite loop 1 votes 1 votes Nandkishor3939 commented Feb 4, 2019 reply Follow Share But the return type is void ... so i think their is no need to return then 0 votes 0 votes Hemanth_13 commented Feb 4, 2019 reply Follow Share Forgot to mention I tried with input as 0 and it went to infinite loop but later realised n>0 :p 0 votes 0 votes Duffer commented Feb 4, 2019 reply Follow Share In order to execute the program correctly, You had to use : if n==0 return; 0 votes 0 votes prashant jha 1 commented Feb 4, 2019 reply Follow Share the base condition is n<0 , will never be true , since 0/2 =0. So it will only terminate when stack overflow happens. 1 votes 1 votes xariniov9 commented Feb 4, 2019 reply Follow Share It will not print anything and will terminate when stack overflows. I am not sure if there was such an option. 0 votes 0 votes Deepanshu commented Feb 4, 2019 reply Follow Share it will print why are you saying it will not print anything .... yes it will never terminate about print see first time 4/2 =0 so printf next statement which says zero after sometime only zero only comes it will print na....... i am not getting logic behind no print 0 votes 0 votes xariniov9 commented Feb 4, 2019 reply Follow Share It will not print because the print statement is after the recursive call. Program flow will never reach at print statement. 0 votes 0 votes prashant jha 1 commented Feb 4, 2019 reply Follow Share @Deepanshu Because of the recursive call before the print statement . Even if the program terminates because of stack overflow , it'll not print anything . 1 votes 1 votes Deepanshu commented Feb 4, 2019 reply Follow Share bro i dont know what happened in paper so many silly mistakes ... so many 0 votes 0 votes manisha11 commented Feb 4, 2019 reply Follow Share yes won't print anything, as print statements will never be seen again due to recursive calls:P 1 votes 1 votes prashant jha 1 commented Feb 4, 2019 reply Follow Share @Deepanshu I can feel u bro , the paper was not tough at all . I lost to panic . Won't be lamenting over it , since gate won't be giving marks on excuses . :) 0 votes 0 votes Neeti priya commented Feb 4, 2019 reply Follow Share Same here.i too lost marks on very easy questions. 0 votes 0 votes Please log in or register to add a comment.