How to use Arithmetic operators in C Language
Arithmetic operators
On this page
Arithmetic operators
Program to use Arithmetic operators in C Language
#include <stdio.h>
int main()
{
int a = 17, b = 4;
printf("sum=%d\n", a + b);
printf("defference=%d\n", a - b);
printf("proudct=%d\n", a * b);
printf("quotient=%d\n", a / b);
printf("remainder=%d\n", a % b);
return 0;
}
Output
Sum = 21
Difference = 13
Product = 68
Quotient = 4
Remainder = 1
Steps Description
- Declare integer variable a and b
- Initialize int integer variable a = 17, b = 4
- printf inbuild function to display sum of variable a and b with decimal place holder %d
- printf inbuild function to display difference of variable a and b with decimal place holder%d
- printf inbuild function to display product of variable a and b with decimal place holder %d
- printf inbuild function to display quotient of variable a and b with place holder %d
- printf inbuild function to display remainder of variable a and b with decimal place holder %d