// Example of arithmetic operations #include int main() { int x, y; float a, b; printf("Enter integer value for x: "); scanf("%d", &x); printf("Enter integer value for y: "); scanf("%d", &y); // display arithmetic results printf("\n"); printf("%d + %d = %d\n", x, y, x + y ); printf("%d - %d = %d\n", x, y, x - y ); printf("%d * %d = %d\n", x, y, x * y ); printf("%d / %d = %d\n", x, y, x / y ); printf("%d %% %d = %d\n", x, y, x % y ); printf("\n"); // now try it for doubles printf("Enter float value for a: "); scanf("%f", &a); printf("Enter float value for b: "); scanf("%f", &b); // display arithmetic results printf("%f + %f = %f\n", a, b, a + b ); printf("%f - %f = %f\n", a, b, a - b ); printf("%f * %f = %f\n", a, b, a * b ); printf("%f / %f = %f\n", a, b, a / b ); // Notice that any attempt to compile the line below will not work // The % operator is NOT valid for floating point types // // printf("%f %% %f = %f\n", a, b, a % b ); printf("\nGoodbye!\n"); return 0; }