Now if I enter, for example, 90 and 3, I get the result 0. But if I try 9 and 0.3 (which should give me an identical response), I get... 1.22125e-15 !Code:#include <iostream> using namespace std; int main() { double a, b; while (1) { cout << "Enter 1st number (0 to quit): "; cin >> a; if (a == 0) break; cout << "Enter 2nd number (0 to quit): "; cin >> b; if (b == 0) break; while (a >= b) a -= b; cout << "Result: " << a << endl; } return 0; }
Can someone explain why this is happening?
thanks
--