[Solved] C program to fill an integer array of size 5

$25

File Name: C_program_to_fill_an_integer_array_of_size_5.zip
File Size: 414.48 KB

SKU: [Solved] C program to fill an integer array of size 5 Category: Tag:
5/5 - (1 vote)

Write a C program to fill an integer array of size 5 and print how many perfect numbers are in this array. A perfect number is defined as a positive integer that is equal to the sum of its proper divisors.

Declare an integer array of size 5

Fill the array with positive numbers only

Write a function called (isPerfect) to detect if an integer is a perfect number or not. The function takes an integer n as input and returns the same number if it is perfect, or -1 if it is not perfect.

Use the function (isPerfect) to write the code to loop through the array and counts the perfect numbers only. Then print the count.

Example of a perfect number:

6 = 1 + 2 + 3

28 = 1 + 2 + 4 + 7 + 14

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] C program to fill an integer array of size 5
$25