Question: Please, Do not modify Main function. Int p r t_triangle1, int prt_triangle2, int prt_triangle3, int prt_triangle4 need to be implemented only. Implement four versions of
Please, Do not modify Main function. Int prt_triangle1, int prt_triangle2, int prt_triangle3, int prt_triangle4 need to be implemented only.

Implement four versions of a function prt_triangle that takes a positive integer n as input argument and prints a triangle of length n with asterisks (*): using a for loop in prt_triangle1, using a while loop in prt_triangle2, using a do-while loop in prt_triangle3, and using recursion in prt_triangle4. Your output for the included test code should be:
prt_triangle1(3) * * * * * * prt_triangle2(3) * * * * * * prt_triangle3(3) * * * * * * prt_triangle4(3) * * * * * *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
