In this article, we will see a simple C program to print all the numbers between 1 and 100 that are divisible by 3 and 5 both.

## C Program to print numbers that are divisible by 3 and 5 between 1 and 100

The program iterates through from numbers 1 to 100 using for loop. In this loop, it checks each number whether it’s divisible by 3 and 5 both using **modulo operator %**. If the remainder after dividing the number by 3 and 5 is zero (in both cases), then this number is divisible by both 3 and 5, program prints this number.

#include <stdio.h>

int main() {

printf("Numbers between 1 and 100 divisible by both 3 and 5 are:\n");

// Loop through numbers from 1 to 100

for (int i = 1; i <= 100; i++) {

// Check if the number is divisible by both 3 and 5

if (i % 3 == 0 && i % 5 == 0) {

printf("%d\n", i);

}

}

return 0;

}

### Output:

Numbers between 1 and 100 divisible by both 3 and 5 are:

15

30

45

60

75

90

## Leave a Reply