C-Programming
CMPSC1113: Computer Programming I
East Central University
Department of Mathematics and Computer Science
Assignment 5
Instructor: Dr. Khem Poudel
Please submit the answers of following question in word document with filename LastNameFirstName_Assignment1.doc and .c file(you can make single zip files of all) in Black Board by April 23, 2021
Q.N.1
Explain briefly about function definition and declarations in C programming. 20 Pt
2.Programming Exercise: 70 Pt
Please write a C program to solve these problem and include the output of screen shot along with separate .c file. Please include separate c file for each question. You can submit single zip file that includes all of the c file and this .doc file.
5.26 (Perfect Numbers) An integer number 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. Write a function isPerfect that determines whether parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.
(40 pts)
5.28 (Reversing Digits) Write a function that takes an integer value and returns the number with its digits reversed. For example, given the number 7631, the function should return 1367.
15 Pts
5.29 (Greatest Common Divisor) The greatest common divisor (GCD) of two integers is the largest integer that evenly divides each of the two numbers. Write a function gcd that returns the greatest common divisor of two integers.
15 pts
PAGE
Page 1 of 2