Question: Write a program in C that has the following functions, Function 1 is named getRandom. The function has two parameters of integer type, min and
Write a program in C that has the following functions, Function 1 is named getRandom. The function has two parameters of integer type, min and max. It generates and return a random number between min and max inclusive. Function 2 is named getSummation. The function has one parameter of integer type, num. It calculates and return the summation from 1 to num inclusive. That is, it returns the value of 1 + 2 + 3 + + num. Function 3 is named printFactors. The function has one parameter of integer type, num. It prints the list of all factors of num, and return nothing. The last function is the main function. It asks the user to enter the min and max, checks if the two numbers are valid. The numbers are valid when both numbers are positive and min is not greater than max. o If the numbers are not valid, then print a message. Otherwise, get a random number num between min and max using function getRandom, then get the summation of num by calling function getSummation and print the summation, and finally print all factors of num by calling function printFactors. Do not use goto statement, recursion, or global variables. No Comment is required in your code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
