WAP- Given the values of three variables a, b and c, write a program to compute and display the value of x, where x=a/(b-c)
- a=250, b=85, c=25
- a=300, b=70, c=70
//E Balagurusamy, Programming In ANSI C,4E
//Exercise 1.8, page 21
#define a 300
#define b 70
#define c 70
printf("For a=%d, b=%d, c=%d,\n",a,b,c);
printf("x is %d",a/(b-c));
In case 1, the program executes without any warnings to give the expected output.
In case 2, the compiler gives a warning that division is being performed by zero, but gives the result as if dividing by 1 or say ignoring that portion of expression altogether, which is dividing by zero.