Starting from:
$28

$18.20

[SOLVED] CMPE 252 - C Programming Lab 1

Part 1 (25 points)

Write a recursive function void printPowersInRange(int n, int p, int count, int minVal, int maxVal) that prints all integer for the equation np + 3p, where they are in range [minVal maxVal] inclusively. Finally you should print total number of p that satiffies minimum and maximum values.
Assume that • n is an integer greater than 1. • minVal and maxVal are positive integers where maxVal >= minVal. • P is between 0 and ∞. Your task in this part to fill in the missing function definition in skeleton code lab1part1.c. The remaining part of the code (such as main function) will stay as it is. Here are example runs of the program:


Part 2 (75 points)

In this part, you are going to implement the following function in skeleton code lab1part2.c: void findClosestPoint(double *length, double *closestX, double *closestY); This function is supposed to do the following tasks: • Read x and y coordinate of points using scanf function until reaching EOF.

• Calculate to distance from this point to origin (0,0) using this formula: √(𝑥1) 2 + (𝑦1) 2 • Find closest point to origin. • Output computed values through the pointer variables listed in the function’s formal parameter list.

Your task in this part to fill in the missing function definition in skeleton code lab1part2.c. The remaining part of the code (such as main function) will stay as it is. Here is a sample run of the program: