1 votes 1 votes #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. renu sharma asked Sep 11, 2017 renu sharma 1.7k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes cout<<"*"; is not the part of else statement..... sandeepjkh answered Sep 11, 2017 sandeepjkh comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments sandeepjkh commented Sep 12, 2017 reply Follow Share 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 votes 1 votes renu sharma commented Sep 12, 2017 reply Follow Share Thankyou! I got this now (y) 0 votes 0 votes sandeepjkh commented Sep 12, 2017 reply Follow Share Your welcome 0 votes 0 votes Please log in or register to add a comment.