Question: a 2. Write a C program that reads a positive integer value greater than 9 (let's say it gets stored in variable n) as a

a 2. Write a C program that reads a positive integer value greater than 9 (let's say it gets stored in variable n) as a command line argument. The program then prints all perfect numbers between 1 and n. A perfect number is defined as one whose factors (other than itself) add up to the number itself. e.g. factors of 6 (other than itself) are 1,2 and 3. Sum of factors is also 6; 6 = 1+2+3. Similarly, the next perfect number is 28 because factors are 1,2,4,7,14 and 28=1+2+4+7+14 Make sure your program doesn't run if the value entered is not a positive integer greater than 9. It should exit giving an error that the number was not greater than 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
