For reasons I can't understand, this crashes with a floating point exception.
This is surprising, because I do not appear to have any floating point operations in my code and I don't set i
to 0
. I've even added i * i != 0
to my code to make sure that this is the case.
Please could someone help me?
This is my code:
#include <iostream>
int main() {
const int A = 42;
int i;
i * i != 0;
for (i = 1; i < 99999999; i++) {
if (A % (i * i) == 0) {
std::cout << i << std::endl;
}
}
}