Question: Design a program in C using the method of call by value together with the switch command, which, when executed, will compute either the triangular

Design a program in C using the method of call by value together with the switch command, which, when executed, will compute either the triangular number tNo(n) defined by the formula tNo(n)=1+2++n or the factorial fNo(n) defined the formula fNo(n)=1.2.3n, with n being a user-specified positive integer number. Two prototype functions called triangular and factorial are to be employed in your call by value method.

Your program is to operate over an infinite loop unless the user inputs a value of 0 for n, in which event the whole process is terminated. The four programs specified below are to be designed, followed by the drawing of the flowchart for the first program. The difference between the four programs lies in whether a prototype function is placed before or after the main function, and whether the outputting is done from within the prototype function or from within the main function as specified below:

PROGRAM 1: Both prototype functions are placed before the main function, and the outputting to the console is done from within the prototype functions.

PROGRAM 2: Both prototype functions are placed before the main function, and the outputting to the console is done from within the main function.

PROGRAM 3: Both prototype functions are placed after the main function, and the outputting to the console is done from within the main function.

PROGRAM 4: The prototype function triangular is placed before the main function and the prototype function factorial is placed after the main function, with outputting to the console done from within the main function.

FLOWCHART: Draw the flowchart corresponding to PROGRAM 1.

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!