C Program to Demonstrates binary expressions using integer arithmetic
C Program : C Program to demonstrates binary expressions using integer arithmetic
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #include<stdio.h> int main() { /* Local Definitions */ int a = 5; int b = 5; /*Statements*/ printf("%d + %d = %d \n", a, b, a + b); printf("%d - %d = %d \n", a, b, a - b); printf("%d * %d = %d \n", a, b, a * b); printf("%d / %d = %d \n", a, b, a / b); printf("%d %% %d = %d\n", a, b, a % b); return(0); } |
Output :
1 2 3 4 5 | 5 + 5 = 10 5 - 5 = 0 5 * 5 = 25 5 / 5 = 1 5 % 5 = 0 |
Explanation :
In order to print “%” symbol inside printf, use “%%”. because % symbol has pre-defined meaning inside printf statement.