// A simple example of how problems can arise when // we perform operations such as division on integers, // and we want these operations to produce real numbers // as results. In C, operations on integers produce // integer results. // // refer to division_incorrect2.cpp for another incorrect // version, and to division_correct.cpp for the corrected version. #include int main() { int a, b; printf("enter a and b\n"); scanf("%d %d", &a, &b); // This is an integer operation, with the result // stored in an integer. // If the division result is not an integer, then // c will not be the true division result. int c = a / b; // this prints out the incorrect result printf("c = %d\n", c); }