[Courses] [C] Lesson Three: Basic Declarations & Expressions
Anand R
anand.r at cybertech.co.in
Fri Oct 11 15:02:17 EST 2002
I tried doing the parenthesis thing around 9/(3-3) and got this:
[root at tux linuxchix]# ./a
9
12
1
2
6
2
Floating point exception (core dumped)
-------------------------------------------------------------------------
>>>> /* expressn.c -- using arithmetic operators in expressions */
>>>> #include <stdio.h>
>>>>
int main(void)
{
printf("%d\n", 1 + 2 * 4);
printf("%d\n", (1 + 2) * 4);
printf("%d\n", 5 / 3);
printf("%d\n", 5 % 3);
printf("%d\n", 8 - 4 / 2);
printf("%d\n", (8 - 4) / 2);
printf("%d\n", 9 / 3 - 3);
return 0;
}
>>>>>>What happens if we put parentheses around the subtraction in the
>>>>>last printf()? 9 / ( 3 - 3 ) Will your computer divide by zero?
------------------------------------------------------------------------
More information about the Courses
mailing list