Skip to content

Commit 13b2e10

Browse files
committed
added: 101-natural.c
1 parent ca70d99 commit 13b2e10

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <stdio.h>
2+
3+
/**
4+
* main - compute and prints all numbers that are below 1024
5+
* and multiple of 3 or 5
6+
*
7+
* Return: return nothing.
8+
*/
9+
void main(void)
10+
{
11+
int module1 = 3;
12+
int module2 = 5;
13+
int baseNum = 1024;
14+
int sum = 0;
15+
16+
while (baseNum >= 3)
17+
{
18+
baseNum--;
19+
if ((baseNum % 3 == 0) || (baseNum % 5 == 0))
20+
{
21+
sum = sum + baseNum;
22+
}
23+
}
24+
printf("%d\n", sum);
25+
}

0 commit comments

Comments
 (0)