For HW I'm suppose to : Write a program that finds out how many numbers below 10,000 are divisible by both 3 and 26.
This is what I have so far
#include <iostream>
using namespace std;
int main ()
{
int z, counter;
counter=0;
for (int n =10000; n>=0; n+=78) {
z = n % 78; //numbers divisible by 78 between10,000 are also divisible by both 3 and 26.
if (z==0) {
counter++; //counts the amount of numbers divisible by both
}
cout << counter << endl;
system ("pause");
}
}
This is what I get 0. I do not get what I did wrong. For the "for" I made it to start at 10,000 and keep subtracting 78 until it equals 0. Help please !!