Arithmetic Operators in C Programming
November 2, 2020
In all programming languages you will find arithmetic operators. Arithmetic operators are used with numeric values to perform common mathematical operations. In this tutorial I will show you the arithmetic operators in C programming language.
Now, let’s see the arithmetic operators in C programming language:
| Operator | Name | Example |
|---|---|---|
| + | Addition | x + y |
| – | Subtraction | x – y |
| * | Multiplication | x * y |
| / | Division | x / y |
| % | Modulus | x % y |
C program code with arithmetic & assignment operators:
#include<stdio.h>
void main()
{
int a=9,b=3,c=0;
printf("a+b=%d\n",a+b);
printf("a-b=%d\n",a-b);
printf("a*b=%d\n",a*b);
printf("a/b =%d\n",a/b);
printf("Reminder(a%b)=%d\n",a%b);
}
Output:
a+b=12 a-b=6 a*b=27 a/b=3 Reminder(a%b)=0
Click Operators in C to know other operators in C programming language.
In this tutorial, I have shown arithmetic operators in C. Hope you have enjoyed the tutorial. If you want to get updated, like the facebook page http://www.facebook.com/freetechtrainer and stay connected.