blob: dd374d57698fc33b128e7293dc7f1fa37f31d36a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//Example 3.2
//signed integer opernds
a=11
b=-3
printf("\na+b= %d", a+b);
printf("\na-b= %d", a-b);
printf("\na*b= %d", a*b);
printf("\na/b= %d", a/b);
//modulo() here is equivalent to% operator of c, but can operate on float values also
ab = modulo(a,b);
printf("\n a\b= %d",ab);
printf("\nIf both a and b are negative:");
a=-11
b=-3
printf("\na/b= %d", a/b);
ab = modulo(a,b);
printf("\n a\b= %d",ab);
|