#include <iostream>
using namespace std;

int main() {
    int N;

    cout << "Ingresa un número entero positivo N: ";
    cin >> N;

    if (N <= 0) {
        cout << "Por favor, ingresa un número entero positivo." << endl;
        return 1; 
    }

    int contador = 0;
    int i = 1;

    while (i <= N) {
        if (i % 3 == 0 && i % 5 == 0) {
            contador++; 
        }
        i++; 
    }

    cout << "La cantidad de números entre 1 y " << N << " que son divisibles por 3 y 5 es: " << contador << endl;

    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: