Question: Draw CFG (Control Flow Graph) for program 7.5. Enumerate all paths through this program that traverse the loop zero times and once 1 begin 2

Draw CFG (Control Flow Graph) for program 7.5. Enumerate all paths through this program that traverse the loop zero times and once

Draw CFG (Control Flow Graph) for program 7.5. Enumerate all paths through

1 begin 2 int x, Y 3 int product, request: #define exp-1 #define fact-2 #define exit-3 get_request (request); I/ Get user request (one of three possibilities) product=1; // Initialize product IISet up the loop to accept and execute requests 6 7 9 10 while (true) [ 11 Process the "exponentiation" request 12 13 14 15 16 17 End of processing the "exponentiation" if (request== exp); input (x, y); count-y; while (count0) product= product's: count=count-l ; request 18 Process "factorial" request 19 else if (requestfact) 20 21 input (x); count-x while (count >0) product-productcount, count=count-l; 23 24IEnd of processing the "factorial" request. 25 Process "exit" request. 26 elseif (requestexit) 27 output( Thanks for using this program. Bye!"); 28 break;I/ Exit the loop. End of if output(product): I/Output the value of exponential or factorial. 29 get_request (request); l Get user request once again and jump to loop begin 30 31 32 end 1 begin 2 int x, Y 3 int product, request: #define exp-1 #define fact-2 #define exit-3 get_request (request); I/ Get user request (one of three possibilities) product=1; // Initialize product IISet up the loop to accept and execute requests 6 7 9 10 while (true) [ 11 Process the "exponentiation" request 12 13 14 15 16 17 End of processing the "exponentiation" if (request== exp); input (x, y); count-y; while (count0) product= product's: count=count-l ; request 18 Process "factorial" request 19 else if (requestfact) 20 21 input (x); count-x while (count >0) product-productcount, count=count-l; 23 24IEnd of processing the "factorial" request. 25 Process "exit" request. 26 elseif (requestexit) 27 output( Thanks for using this program. Bye!"); 28 break;I/ Exit the loop. End of if output(product): I/Output the value of exponential or factorial. 29 get_request (request); l Get user request once again and jump to loop begin 30 31 32 end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!