Skip to content

Commit b46c936

Browse files
committed
Bug fixed: 101-natural.c
1 parent 13b2e10 commit b46c936

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

0x02-functions_nested_loops/101-natural.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,21 @@
66
*
77
* Return: return nothing.
88
*/
9-
void main(void)
9+
int main(void)
1010
{
1111
int module1 = 3;
1212
int module2 = 5;
1313
int baseNum = 1024;
1414
int sum = 0;
1515

16-
while (baseNum >= 3)
16+
while (baseNum >= 1)
1717
{
1818
baseNum--;
19-
if ((baseNum % 3 == 0) || (baseNum % 5 == 0))
19+
if ((baseNum % module1 == 0) || (baseNum % module2 == 0))
2020
{
2121
sum = sum + baseNum;
2222
}
2323
}
2424
printf("%d\n", sum);
25+
return (0);
2526
}

0 commit comments

Comments
 (0)