#include<stdio.h> 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); }
Output :
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.
No comments:
Post a Comment