#include <iostream> using namespace std; int main() { double result, n, d; cout << "Enter value: "; cin >> n; cout << "Enter divisor: "; cin >> d; if(d != 0) { cout << "d does not equal zero so division is OK" << "\n"; result = n / d; cout << n << " / " << d << " is " << result; } return 0; }
Enter value: 12 Enter divisor: 21 d does not equal zero so division is OK 12 / 21 is 0.571429"