May 20, 2023
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
Step / Description
- Declare integer variable
a
andb
- Initialize int integer variable
a = 17
,b = 4
printf
inbuild function to display sum of variablea
andb
with decimal place holder%d
printf
inbuild function to display difference of variablea
andb
with decimal place holder%d
printf
inbuild function to display product of variablea and
b
with decimal place holder%d
printf
inbuild function to display quotient of variablea
andb
with place holder%d
printf
inbuild function to display remainder of variablea
andb
with decimal place holder%d
by : Nadeem Khan
Quick Summary:
Arithmetic Operators