Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create program that loops from 2 to up to 1000 and calculates the sum of all the

ID: 3694129 • Letter: C

Question

Create program that loops from 2 to up to 1000 and calculates the sum of all the proper divisors each number in the sequence (not including the number itself) Some numbers are special in the that sum of their proper divisors is equal to the original number If you find such a case your program should announce it as a Special number. The divisor(s) of 2 are: 1 which sum(s) to 1 The divisor(s) of 3 are: I which sure(s) to 1 The divisor(s) of 4 are: 1, 2 which sum(s) to 3 The divisor(s) of 5 are: 1 which sura (s) to 1 The divisor(s) of 6 are: 1, 2, 3 which sum(s) to 6 *** 6 is a Special Number The divisor(s) of 27 are: 1, 9 which sum(s) to 10 The divisor(s) of 28 are: 1. 2, 4. 7, 14 which sum(s) to: 28 *** 28 is a Special Number

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>

//funtion prototype
int sumAndPrintProperDivisors(int);
int main()
{
int i,sum;
//repeat loop from 2 to 1000
for(i=2; i<=1000; i++)
{
printf("The divisors of %d are : ",i);
sum=sumAndPrintProperDivisors(i);
printf("which sum(s) to %d ",sum);
//check the number is special or not
if(sum==i)
printf("*** %d is Special Number ",i);
}

return 0;
}
//accepts an integer from the caller and then computes,
//prints and sums all of the proper divisors of that number
//finally, the sum is returned to the caller to be analyzed there

int sumAndPrintProperDivisors(int n)
{
int sum=0,i;
for(i=1; i<n; i++)
{
//check the number is divisor or not
if(n%i==0)
{
printf("%d, ",i);
//add the divisor to sum
sum+=i;
}

}
return sum;

}

OUTPUT:

The divisors of 2 are : 1, which sum(s) to 1
The divisors of 3 are : 1, which sum(s) to 1
The divisors of 4 are : 1, 2, which sum(s) to 3
The divisors of 5 are : 1, which sum(s) to 1
The divisors of 6 are : 1, 2, 3, which sum(s) to 6
*** 6 is Special Number
The divisors of 7 are : 1, which sum(s) to 1
The divisors of 8 are : 1, 2, 4, which sum(s) to 7
The divisors of 9 are : 1, 3, which sum(s) to 4
The divisors of 10 are : 1, 2, 5, which sum(s) to 8
The divisors of 11 are : 1, which sum(s) to 1
The divisors of 12 are : 1, 2, 3, 4, 6, which sum(s) to 16
The divisors of 13 are : 1, which sum(s) to 1
The divisors of 14 are : 1, 2, 7, which sum(s) to 10
The divisors of 15 are : 1, 3, 5, which sum(s) to 9
The divisors of 16 are : 1, 2, 4, 8, which sum(s) to 15
The divisors of 17 are : 1, which sum(s) to 1
The divisors of 18 are : 1, 2, 3, 6, 9, which sum(s) to 21
The divisors of 19 are : 1, which sum(s) to 1
The divisors of 20 are : 1, 2, 4, 5, 10, which sum(s) to 22
The divisors of 21 are : 1, 3, 7, which sum(s) to 11
The divisors of 22 are : 1, 2, 11, which sum(s) to 14
The divisors of 23 are : 1, which sum(s) to 1
The divisors of 24 are : 1, 2, 3, 4, 6, 8, 12, which sum(s) to 36
The divisors of 25 are : 1, 5, which sum(s) to 6
The divisors of 26 are : 1, 2, 13, which sum(s) to 16
The divisors of 27 are : 1, 3, 9, which sum(s) to 13
The divisors of 28 are : 1, 2, 4, 7, 14, which sum(s) to 28
*** 28 is Special Number
The divisors of 29 are : 1, which sum(s) to 1
The divisors of 30 are : 1, 2, 3, 5, 6, 10, 15, which sum(s) to 42
The divisors of 31 are : 1, which sum(s) to 1
The divisors of 32 are : 1, 2, 4, 8, 16, which sum(s) to 31
The divisors of 33 are : 1, 3, 11, which sum(s) to 15
The divisors of 34 are : 1, 2, 17, which sum(s) to 20
The divisors of 35 are : 1, 5, 7, which sum(s) to 13
The divisors of 36 are : 1, 2, 3, 4, 6, 9, 12, 18, which sum(s) to 55
The divisors of 37 are : 1, which sum(s) to 1
The divisors of 38 are : 1, 2, 19, which sum(s) to 22
The divisors of 39 are : 1, 3, 13, which sum(s) to 17
The divisors of 40 are : 1, 2, 4, 5, 8, 10, 20, which sum(s) to 50
The divisors of 41 are : 1, which sum(s) to 1
The divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, which sum(s) to 54
The divisors of 43 are : 1, which sum(s) to 1
The divisors of 44 are : 1, 2, 4, 11, 22, which sum(s) to 40
The divisors of 45 are : 1, 3, 5, 9, 15, which sum(s) to 33
The divisors of 46 are : 1, 2, 23, which sum(s) to 26
The divisors of 47 are : 1, which sum(s) to 1
The divisors of 48 are : 1, 2, 3, 4, 6, 8, 12, 16, 24, which sum(s) to 76
The divisors of 49 are : 1, 7, which sum(s) to 8
The divisors of 50 are : 1, 2, 5, 10, 25, which sum(s) to 43
The divisors of 51 are : 1, 3, 17, which sum(s) to 21
The divisors of 52 are : 1, 2, 4, 13, 26, which sum(s) to 46
The divisors of 53 are : 1, which sum(s) to 1
The divisors of 54 are : 1, 2, 3, 6, 9, 18, 27, which sum(s) to 66
The divisors of 55 are : 1, 5, 11, which sum(s) to 17
The divisors of 56 are : 1, 2, 4, 7, 8, 14, 28, which sum(s) to 64
The divisors of 57 are : 1, 3, 19, which sum(s) to 23
The divisors of 58 are : 1, 2, 29, which sum(s) to 32
The divisors of 59 are : 1, which sum(s) to 1
The divisors of 60 are : 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, which sum(s) to 108
The divisors of 61 are : 1, which sum(s) to 1
The divisors of 62 are : 1, 2, 31, which sum(s) to 34
The divisors of 63 are : 1, 3, 7, 9, 21, which sum(s) to 41
The divisors of 64 are : 1, 2, 4, 8, 16, 32, which sum(s) to 63
The divisors of 65 are : 1, 5, 13, which sum(s) to 19
The divisors of 66 are : 1, 2, 3, 6, 11, 22, 33, which sum(s) to 78
The divisors of 67 are : 1, which sum(s) to 1
The divisors of 68 are : 1, 2, 4, 17, 34, which sum(s) to 58
The divisors of 69 are : 1, 3, 23, which sum(s) to 27
The divisors of 70 are : 1, 2, 5, 7, 10, 14, 35, which sum(s) to 74
The divisors of 71 are : 1, which sum(s) to 1
The divisors of 72 are : 1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, which sum(s) to 123
The divisors of 73 are : 1, which sum(s) to 1
The divisors of 74 are : 1, 2, 37, which sum(s) to 40
The divisors of 75 are : 1, 3, 5, 15, 25, which sum(s) to 49
The divisors of 76 are : 1, 2, 4, 19, 38, which sum(s) to 64
The divisors of 77 are : 1, 7, 11, which sum(s) to 19
The divisors of 78 are : 1, 2, 3, 6, 13, 26, 39, which sum(s) to 90
The divisors of 79 are : 1, which sum(s) to 1
The divisors of 80 are : 1, 2, 4, 5, 8, 10, 16, 20, 40, which sum(s) to 106
The divisors of 81 are : 1, 3, 9, 27, which sum(s) to 40
The divisors of 82 are : 1, 2, 41, which sum(s) to 44
The divisors of 83 are : 1, which sum(s) to 1
The divisors of 84 are : 1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, which sum(s) to 140
The divisors of 85 are : 1, 5, 17, which sum(s) to 23
The divisors of 86 are : 1, 2, 43, which sum(s) to 46
The divisors of 87 are : 1, 3, 29, which sum(s) to 33
The divisors of 88 are : 1, 2, 4, 8, 11, 22, 44, which sum(s) to 92
The divisors of 89 are : 1, which sum(s) to 1
The divisors of 90 are : 1, 2, 3, 5, 6, 9, 10, 15, 18, 30, 45, which sum(s) to 144
The divisors of 91 are : 1, 7, 13, which sum(s) to 21
The divisors of 92 are : 1, 2, 4, 23, 46, which sum(s) to 76
The divisors of 93 are : 1, 3, 31, which sum(s) to 35
The divisors of 94 are : 1, 2, 47, which sum(s) to 50
The divisors of 95 are : 1, 5, 19, which sum(s) to 25
The divisors of 96 are : 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, which sum(s) to 156
The divisors of 97 are : 1, which sum(s) to 1
The divisors of 98 are : 1, 2, 7, 14, 49, which sum(s) to 73
The divisors of 99 are : 1, 3, 9, 11, 33, which sum(s) to 57
The divisors of 100 are : 1, 2, 4, 5, 10, 20, 25, 50, which sum(s) to 117
The divisors of 101 are : 1, which sum(s) to 1
The divisors of 102 are : 1, 2, 3, 6, 17, 34, 51, which sum(s) to 114
The divisors of 103 are : 1, which sum(s) to 1
The divisors of 104 are : 1, 2, 4, 8, 13, 26, 52, which sum(s) to 106
The divisors of 105 are : 1, 3, 5, 7, 15, 21, 35, which sum(s) to 87
The divisors of 106 are : 1, 2, 53, which sum(s) to 56
The divisors of 107 are : 1, which sum(s) to 1
The divisors of 108 are : 1, 2, 3, 4, 6, 9, 12, 18, 27, 36, 54, which sum(s) to 172
The divisors of 109 are : 1, which sum(s) to 1
The divisors of 110 are : 1, 2, 5, 10, 11, 22, 55, which sum(s) to 106
The divisors of 111 are : 1, 3, 37, which sum(s) to 41
The divisors of 112 are : 1, 2, 4, 7, 8, 14, 16, 28, 56, which sum(s) to 136
The divisors of 113 are : 1, which sum(s) to 1
The divisors of 114 are : 1, 2, 3, 6, 19, 38, 57, which sum(s) to 126
The divisors of 115 are : 1, 5, 23, which sum(s) to 29
The divisors of 116 are : 1, 2, 4, 29, 58, which sum(s) to 94
The divisors of 117 are : 1, 3, 9, 13, 39, which sum(s) to 65
The divisors of 118 are : 1, 2, 59, which sum(s) to 62
The divisors of 119 are : 1, 7, 17, which sum(s) to 25
The divisors of 120 are : 1, 2, 3, 4, 5, 6, 8, 10, 12, 15, 20, 24, 30, 40, 60, which sum(s) to 240
The divisors of 121 are : 1, 11, which sum(s) to 12
The divisors of 122 are : 1, 2, 61, which sum(s) to 64
The divisors of 123 are : 1, 3, 41, which sum(s) to 45
The divisors of 124 are : 1, 2, 4, 31, 62, which sum(s) to 100
The divisors of 125 are : 1, 5, 25, which sum(s) to 31
The divisors of 126 are : 1, 2, 3, 6, 7, 9, 14, 18, 21, 42, 63, which sum(s) to 186
The divisors of 127 are : 1, which sum(s) to 1
The divisors of 128 are : 1, 2, 4, 8, 16, 32, 64, which sum(s) to 127
The divisors of 129 are : 1, 3, 43, which sum(s) to 47
The divisors of 130 are : 1, 2, 5, 10, 13, 26, 65, which sum(s) to 122
The divisors of 131 are : 1, which sum(s) to 1
The divisors of 132 are : 1, 2, 3, 4, 6, 11, 12, 22, 33, 44, 66, which sum(s) to 204
The divisors of 133 are : 1, 7, 19, which sum(s) to 27
The divisors of 134 are : 1, 2, 67, which sum(s) to 70
The divisors of 135 are : 1, 3, 5, 9, 15, 27, 45, which sum(s) to 105
The divisors of 136 are : 1, 2, 4, 8, 17, 34, 68, which sum(s) to 134
The divisors of 137 are : 1, which sum(s) to 1
The divisors of 138 are : 1, 2, 3, 6, 23, 46, 69, which sum(s) to 150
The divisors of 139 are : 1, which sum(s) to 1
The divisors of 140 are : 1, 2, 4, 5, 7, 10, 14, 20, 28, 35, 70, which sum(s) to 196
The divisors of 141 are : 1, 3, 47, which sum(s) to 51
The divisors of 142 are : 1, 2, 71, which sum(s) to 74
The divisors of 143 are : 1, 11, 13, which sum(s) to 25
The divisors of 144 are : 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 36, 48, 72, which sum(s) to 259
The divisors of 145 are : 1, 5, 29, which sum(s) to 35
The divisors of 146 are : 1, 2, 73, which sum(s) to 76
The divisors of 147 are : 1, 3, 7, 21, 49, which sum(s) to 81
The divisors of 148 are : 1, 2, 4, 37, 74, which sum(s) to 118
The divisors of 149 are : 1, which sum(s) to 1
The divisors of 150 are : 1, 2, 3, 5, 6, 10, 15, 25, 30, 50, 75, which sum(s) to 222
The divisors of 151 are : 1, which sum(s) to 1
The divisors of 152 are : 1, 2, 4, 8, 19, 38, 76, which sum(s) to 148
The divisors of 153 are : 1, 3, 9, 17, 51, which sum(s) to 81
The divisors of 154 are : 1, 2, 7, 11, 14, 22, 77, which sum(s) to 134
The divisors of 155 are : 1, 5, 31, which sum(s) to 37
The divisors of 156 are : 1, 2, 3, 4, 6, 12, 13, 26, 39, 52, 78, which sum(s) to 236
The divisors of 157 are : 1, which sum(s) to 1
The divisors of 158 are : 1, 2, 79, which sum(s) to 82
The divisors of 159 are : 1, 3, 53, which sum(s) to 57
The divisors of 160 are : 1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 80, which sum(s) to 218
The divisors of 161 are : 1, 7, 23, which sum(s) to 31
The divisors of 162 are : 1, 2, 3, 6, 9, 18, 27, 54, 81, which sum(s) to 201
The divisors of 163 are : 1, which sum(s) to 1
The divisors of 164 are : 1, 2, 4, 41, 82, which sum(s) to 130
The divisors of 165 are : 1, 3, 5, 11, 15, 33, 55, which sum(s) to 123
The divisors of 166 are : 1, 2, 83, which sum(s) to 86
The divisors of 167 are : 1, which sum(s) to 1
The divisors of 168 are : 1, 2, 3, 4, 6, 7, 8, 12, 14, 21, 24, 28, 42, 56, 84, which sum(s) to 312
The divisors of 169 are : 1, 13, which sum(s) to 14
The divisors of 170 are : 1, 2, 5, 10, 17, 34, 85, which sum(s) to 154
The divisors of 171 are : 1, 3, 9, 19, 57, which sum(s) to 89
The divisors of 172 are : 1, 2, 4, 43, 86, which sum(s) to 136
The divisors of 173 are : 1, which sum(s) to 1
The divisors of 174 are : 1, 2, 3, 6, 29, 58, 87, which sum(s) to 186
The divisors of 175 are : 1, 5, 7, 25, 35, which sum(s) to 73
The divisors of 176 are : 1, 2, 4, 8, 11, 16, 22, 44, 88, which sum(s) to 196
The divisors of 177 are : 1, 3, 59, which sum(s) to 63
The divisors of 178 are : 1, 2, 89, which sum(s) to 92
.
.
.
The divisors of 975 are : 1, 3, 5, 13, 15, 25, 39, 65, 75, 195, 325, which sum(s) to 761
The divisors of 976 are : 1, 2, 4, 8, 16, 61, 122, 244, 488, which sum(s) to 946
The divisors of 977 are : 1, which sum(s) to 1
The divisors of 978 are : 1, 2, 3, 6, 163, 326, 489, which sum(s) to 990
The divisors of 979 are : 1, 11, 89, which sum(s) to 101
The divisors of 980 are : 1, 2, 4, 5, 7, 10, 14, 20, 28, 35, 49, 70, 98, 140, 196, 245, 490, which s
um(s) to 1414
The divisors of 981 are : 1, 3, 9, 109, 327, which sum(s) to 449
The divisors of 982 are : 1, 2, 491, which sum(s) to 494
The divisors of 983 are : 1, which sum(s) to 1
The divisors of 984 are : 1, 2, 3, 4, 6, 8, 12, 24, 41, 82, 123, 164, 246, 328, 492, which sum(s) to
1536
The divisors of 985 are : 1, 5, 197, which sum(s) to 203
The divisors of 986 are : 1, 2, 17, 29, 34, 58, 493, which sum(s) to 634
The divisors of 987 are : 1, 3, 7, 21, 47, 141, 329, which sum(s) to 549
The divisors of 988 are : 1, 2, 4, 13, 19, 26, 38, 52, 76, 247, 494, which sum(s) to 972
The divisors of 989 are : 1, 23, 43, which sum(s) to 67
The divisors of 990 are : 1, 2, 3, 5, 6, 9, 10, 11, 15, 18, 22, 30, 33, 45, 55, 66, 90, 99, 110, 165
, 198, 330, 495, which sum(s) to 1818
The divisors of 991 are : 1, which sum(s) to 1
The divisors of 992 are : 1, 2, 4, 8, 16, 31, 32, 62, 124, 248, 496, which sum(s) to 1024
The divisors of 993 are : 1, 3, 331, which sum(s) to 335
The divisors of 994 are : 1, 2, 7, 14, 71, 142, 497, which sum(s) to 734
The divisors of 995 are : 1, 5, 199, which sum(s) to 205
The divisors of 996 are : 1, 2, 3, 4, 6, 12, 83, 166, 249, 332, 498, which sum(s) to 1356
The divisors of 997 are : 1, which sum(s) to 1
The divisors of 998 are : 1, 2, 499, which sum(s) to 502
The divisors of 999 are : 1, 3, 9, 27, 37, 111, 333, which sum(s) to 521
The divisors of 1000 are : 1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 125, 200, 250, 500, which sum(s)
to 1340

Process returned 0 (0x0) execution time : 1.136 s
Press any key to continue.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote