In: Computer Science
Write a program that prints out all numbers, less than or equal
to 10,000,000, that are evenly divisible by all numbers between 5
and 15 (inclusive).
Do not use any libraries besides stdio.h.
Need it in 10 minutes, please.
#include <stdio.h>
int main()
{
//declare variable
int i = 0;
for(i = 0 ; i<10000000 ; i++)
{
//modulo operator returns the result of integer division.
// if number is divisible by all numbers between 5 to 15 then remaiander is 0 and prints that number
if((i % 5 == 0) &&(i % 6 == 0) &&(i % 7 == 0) &&(i % 8 == 0) &&(i % 9 == 0) &&(i % 10 == 0) &&(i % 11 == 0)
&&(i % 12 == 0) &&(i % 13 == 0) &&(i % 14 == 0)&&(i % 15 == 0))
{
printf("%d \n", i);
}
}
return 0;
}
OUTPUT: