Question #62135

Determine the number of positive integers x, where x <100 and x is divisible by 2,3 or 5

Expert's answer

#include <iostream>

int main() {

int count = 0;

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

if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) count++;

}

std::cout << count;

return 0;

}

int main() {

int count = 0;

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

if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) count++;

}

std::cout << count;

return 0;

}

## Comments

## Leave a comment