Question: 1. Make a new directory for this lab. Place all of the files you create for PA 3 in that directory. 2. Create a makefile.

 1. Make a new directory for this lab. Place all of

the files you create for PA 3 in that directory. 2. Create

1. Make a new directory for this lab. Place all of the files you create for PA 3 in that directory. 2. Create a makefile. There is a separate instruction sheet for this. The "all" target must produce the executable pa3, all lowercase, no extension. Required targets: all, pa3, pa3.o, pa3functions.o The clean target is not required. 3. Create a header file named pa3functions.h. In this file, place the following lines: #ifndef PA3FUNCTIONS #define PA3FUNCTIONS here is where your function prototypes go #endif . 4. Create a source file named pa3functions.c In this file, place the implementations of the following three functions: problem 5.26. A function named perfect that will accept an integer parameter. The function should return 1 if the parameter is a perfect number. Otherwise, it should return 0. An integer is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. . problem 5.27. A function named prime that will accept an integer parameter. The function should return 1 if the number is prime. Otherwise, it should return 0. (See the pseudocode below) function prime (int n) loop from x = 2 to x = sqrt(n) if n is divisible by x, return 0 end loop return 1 end function . problem 5.28. A function named revDigits that accepts an integer parameter. The function should return the number with its digits reversed. Example: revDigits(7631) should return 1367 Example: revDigits(1840) should return 481 Example: revDigits(-945) should return -549 Remember to put #include "pa3functions.h" at the top of the file. 5. Create a source file named pa3.c. In this file, place the main function as follows: // header comments #include "pa3functions.h" #include int main (void) { // use the perfect function to print the positive, perfect numbers // less than 1000 // use the prime function to print the first 20 positive, prime numbers // note: 1 is not a prime // repeat the following process 5 times // use the rand function to generate a random number between // 1 and 10000 (inclusive) // use the revDigits function to obtain the reverse of the number // print the reverse of the number } 6. "make" pa3. If the makefile works correctly, run the executable

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!