#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int N;
cout << "Введите N: ";
cin >> N;
int counter = 0;
for (int i = 1; i < N; i++) {
if (!(i % 2 == 0) && !(i % 3 == 0) && !(i % 5 == 0)) {
counter++;
cout << i << endl;
}
cout << "Итого: " << counter << endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int N;
cout << "Введите N: ";
cin >> N;
int counter = 0;
for (int i = 1; i < N; i++) {
if (!(i % 2 == 0) && !(i % 3 == 0) && !(i % 5 == 0)) {
counter++;
cout << i << endl;
}
}
cout << "Итого: " << counter << endl;
}