Error when debugging in Visual Studio 2015. If you enter a value greater than one then the program works, you enter less - it breaks.
#include <iostream> #include <iostream> using namespace std; int main() { int y=0, eps, i=2, s; cout << "Enter eps " << "\n"; cin >> eps; if (eps >= 1) { cout << "Error" << "\n"; } else { while (eps > s) { s = 1 / i; i++; y = y + s; } cout << "y=" << y; } return 0; }