forked from singhofen/c-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hw6_partC.c
50 lines (41 loc) · 1.3 KB
/
hw6_partC.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
#include <stdlib.h>
main()
{
int number = 8, count = 0, multiple = 0, sum = 0;
while (multiple < 500) {
multiple = number * count;
count = ++count;
if (multiple > 100) {
printf("Your multiple is: %i \n", multiple);
//the code above generates multiples of 8 but
//starting at 104 ending at 504.
sum = multiple * count;
count = ++count;
printf("Your sum of the multiples are: %i \n", sum);
//all the code shown here generates a large sum of the multiples
system("pause");
}
}
}
____________________________________________________________________________________________________________________________________
#include <stdio.h>
#include <stdlib.h>
main()
{
int number = 8, count = 0, multiple = 0, sum = 0;
while (multiple < 500) {
multiple = number * count;
count = ++count;
if (multiple > 100) {
printf("Your multiple is: %i \n", multiple);
//the code above generates multiples of 8 but
//starting at 104 ending at 504.
sum = multiple + count;//using this it gives me multiples of 16 and sum (+count or *count)
count = ++count;
printf("Your sum of the multiples are: %i \n", sum);
//all the code shown here generates a large sum of the multiples by 16
system("pause");
}
}
}