1 1 vote #include <iostream> using namespace std; void quiz(int w) { if(w>1) { quiz (w/2); quiz(w/2); } cout<<"*"; } int main() { quiz(5); return 0; } how many asterisks are printed by the function call quiz(5)? ans is 7. Please explain. Programming in C + – renu sharma 2.4k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote cout<<"*"; is not the part of else statement..... sandeepjkh answered Sep 11, 2017 sandeepjkh comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments sandeepjkh commented Sep 12, 2017 reply Follow flag I think you must be getting **** as the answer...If so then you might have done a mistake...See cout<<"*"; is not the part of else statement in fact there is no else statement at all.....so after executing if statement cout<<"*"; will compulsory be executed.....so final output would be ******* 1 1 replyShare renu sharma commented Sep 12, 2017 reply Follow flag Thankyou! I got this now (y) 0 0 replyShare sandeepjkh commented Sep 12, 2017 reply Follow flag Your welcome 0 0 replyShare Please log in or register to add a comment.