I am trying to see if all the numbers below 1000 are divisible by 3 or 5, however when I execute the program, it just sits there and blinks at me and nothing is printed out to the screen.
#include <iostream>
#include <cmath>
usingnamespace std;
int main()
{
int number = 1000;
int x = 1;
cout << "Calculating all of the numbers below 1000 that are divisible by 3 and 5...";
while (x <= 1000)
{
if ((x % 3) == 0)
{
cout << x << " is divisible by 3" << endl;
x++;
}
elseif ((x % 5) == 0)
{
cout << x << " is divisible by 5" << endl;
x++;
}
else
{
cout << x << " is not divisible by 3 nor 5";
x++;
}
}
return 0;
}