• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » C » Operator » What is Arithmetic operator in C language?
Next →
← Prev

What is Arithmetic operator in C language?

By Dinesh Thakur

Arithmetic operators are used to perform arithmetic operations on arithmetic operands, i. e., operands of integral as well as floating type. Recall that an integral type includes all forms of char and int types, whereas the floating-point types include the float, double and long double types. These operations include addition (+), subtraction (- ), multiplication (*), division (!), modulo arithmetic (%), increment (++), decrement (– ), unary plus (+) and unary minus (- ). They can be grouped into three categories: unary operators, multiplicative operators and additive operators. The arithmetic operators are summarized in Table.

We’ll be covering the following topics in this tutorial:

  • Additive and Multiplicative Operators
  • Unary and Arithmetic Operators

Additive and Multiplicative Operators

The additive operators include addition (+) and subtraction (-) operators. They are binary infix operators that operate on two arithmetic operands, as in a + b and a – b.

The multiplicative operators include three operators: multiplication (*),division (/) and modulo arithmetic (%), i. e., remainder after integer division. These are binary infix operators that operate on two arithmetic operands, as in a * b, a I b and a %b.

The multiplication and division operators operate on any arithmetic operands-both integral and floating-type. As the multiplication symbol is not explicitly written in mathematical expressions, we tend to forget it in C expressions. However, remember that the multiplication operator must be explicitly written in a C expression. Thus, the mathematical expression abc should be written in C language as a * b * c.

                                  Arithmetic operators in the C language

Operator group

Operator

Description

Example

Associativity

Unary operators

           +

Unary plus

        +a

Right to left

           –

Unary minus

        – a

          ++

Prefix increment

Postfix increment

      ++x

      X++

          – –

Prefix decrement

Postfix decrement

       –x

       x–

Multiplicative

           *

Multiplication

      a*b

Left to right

           /

Division

      a/b

          %

Modulo arithmetic

      A%b

Additive operators

          +

Addition

      A+b

Left to right

           –

Subtraction

      a-b

The result of the division operator(/) depends on the type of operands. If both the operands are integral, the result is truncated to the integer value, e. g., 7 I 4 evaluates as 1. However, if either or both operands are floating-type, the result is also floating-type, e. g., the expressions 7.0/4, 7/4.0 and 7.0/4.0 evaluate as 1.75. The modulo arithmetic operator works only with integral operands such as the various int and char types. It gives the remainder after integer division, e.g., 7 % s evaluates as 2, whereas 13 % s evaluates as 3.

The C language does not provide exponentiation operator available in programming languages like FORTRAN and BASIC. Quantities involving small powers such as a2 and a3 are represented using direct multiplication, as in a*a and  a*a*a, respectively. The expression xY is written using standard library function pow (for power) as pow (x, y).

Unary and Arithmetic Operators

The unary arithmetic operators include unary plus (+),unary minus (- ), increment (++) and decrement (–). These operators operate on arithmetic operands. Unary plus and unary minus are prefix operators, e.g., -a, +10. 25, etc. The unary minus operator negates the value of its operand, whereas the unary plus operator has no effect on the value of its operand. Note that the symbols for the unary plus and unary minus operators are the same as those of the addition and subtraction operators, respectively.

The increment operator (++) increments the value of the operand by 1, while the decrement operator (– ) decrements the value of the operand by 1. These operators must be written without a space between the two ‘+’ or’-‘ symbols. They can only be used with modifiable lvalues (such as variables) and not with constants and expressions.

The increment and decrement operators can be used either in prefix form, as in ++x, or in postfix form, as in x++. Although both the forms modify the value of the operand by 1, there is a subtle difference. In the prefix form, the value of the operand is first incremented and then used, whereas in the postfix form, the value of operand is first used and then incremented.

The associativity of operators decides the order in which operators at the same precedence level are bound to operands. The unary and assignment operators have right-to left associativity. If an expression contains more than one unary operator, they are bound to operands from right to left. Remember that only unary operators, assignment operators and conditional operator (?:) have right-to-left associativity. All other operators in C language have left-to-right associativity.

The multiplicative operators have left-to-right associativity. They are bound to operands in the order of their occurrence in an expression from left to right. For example, the expression a*b/c*d is interpreted as ( (a*b) /c) *d, i.e., multiplication of a and b is performed first followed by division and second multiplication. Similarly, the additive operators also have left-to-right associativity.

You’ll also like:

  1. MySql Arithmetic Operator in Servlet
  2. Write C++ program illustrates the hierarchy rule in an arithmetic expression involving arithmetic operators.
  3. Difference Between Procedure Oriented Language and Object Oriented Language
  4. Arithmetic Operators in C
  5. What is Operators in C language?
Next →
← Prev
Like/Subscribe us for latest updates     

About Dinesh Thakur
Dinesh ThakurDinesh Thakur holds an B.C.A, MCDBA, MCSD certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps.

Dinesh Thakur is a Freelance Writer who helps different clients from all over the globe. Dinesh has written over 500+ blogs, 30+ eBooks, and 10000+ Posts for all types of clients.


For any type of query or something that you think is missing, please feel free to Contact us.


Primary Sidebar

C Programming

C Programming Tutorials

  • C - History
  • C - Anatomy
  • C - Constants
  • C - Identifiers
  • C - Data Types
  • C - Libraries File
  • C - Header Files
  • C - Basic Language
  • C - Data Types Sizes
  • C - Header Files Importance
  • C - Escape Sequences
  • C - Main() Purpose
  • C - Program Procedure
  • C - Control Statements
  • C - Enumeration Constant
  • C - Add numbers
  • C - Return Statement
  • C - Avoid Goto
  • C - Command Line Arguments
  • C - Switch Case
  • C - Switch Case Limitations
  • C - getchar() and putchar()
  • C - Iteration Statements
  • C - Pass by Value and Reference
  • C - Structures and Unions
  • C - Structure
  • C - Dynamic Memory
  • C - Fgets and Fputs Functions
  • C - Gets() and Puts() Functions
  • C - Armstrong Number
  • C - Storage Classes
  • C - Fibonacci Series
  • C - Precision Setting
  • C - const Parameters

C - Variable & It's Type

  • C - Variables
  • C - Variable Lifetime
  • C - Static Variable
  • C - Register Variable
  • C - Global Variables
  • C - Auto Variables
  • C - Local Variables

C - Operator & Expressions

  • C - Operator
  • C - Boolean Operators
  • C - Bitwise Operator
  • C - Arithmetic Operators
  • C - Modulus Operator
  • C - Ternary Operator
  • C - Expressions
  • C - Arithmetic Expressions

C - Array

  • C - Arrays
  • C - Array Types
  • C - Array Characteristics
  • C - Static Arrays
  • C - Global Arrays
  • C - 3D Arrays
  • C - Dynamic Arrays
  • C - Pointer to 3D Arrays
  • C - Array Elements Hold
  • C - Arrays as Function Parameters
  • C - Accessing Matrix Elements
  • C - File Handling
  • C - Matrix Multiplication
  • C - Dynamic Memory Allocation

C - Searching & Sorting

  • C - Data Structures
  • C - Linear Search
  • C - Bubble Sort
  • C - Merge Sort
  • C - Linked List
  • C - Insertion Sort
  • C - Binary Search
  • C - Selection Sort
  • C - Quick Sort

C - Functions

  • C - Functions
  • C - Functions Advantages
  • C - Void Functions
  • C - Function Call
  • C - Default Return Value
  • C - String functions

C - Pointer

  • C - Pointers
  • C - Type Casting Of Pointers
  • C - Pointer Advantages
  • C - Pointers Initialization
  • C - Vectors and Pointers

C - Differences

  • C - C Vs C++
  • C - Formal Args. Vs Actual Args.
  • C - Keywords Vs Identifiers
  • C - Strings Vs Character Arrays
  • C - Address Vs Dereference Operator
  • C - Goto Vs longjmp
  • C - Declaring Vs Defining Variable
  • C - String Vs Array
  • C - Call by Value Vs Reference
  • C - Structure Vs Union
  • C - For Vs While loops
  • C - Compiler Vs Interpreter

C - Programs

  • C Program Standard Deviation
  • C Program Calculate Tax
  • C Program Sum Series
  • C Program Merge Arrays
  • C Program Euclid’s Algorithm
  • C Program Print Weekdays
  • C Program Sum of Digits
  • C Program Print a list
  • C Program Print Pythagorean
  • C Program Quiz program
  • C Program Display Table
  • C Program Print Comma-Separated
  • C Program Prints Prime Numbers
  • C Program for Print Integer
  • C Program Count Number
  • C Program Print Color Name
  • C Program Print Odd Numbers
  • C Program Calculate area
  • C Program for a Menu
  • C Program Add Two Vectors
  • C Program Array Addresses
  • C Program Division by Zero Error
  • C Program Compare two Dates
  • C Program Tower of Hanoi
  • C Program return 3 Numbers
  • C Program for Prime Numbers
  • C Program for Factorial
  • C Program for Palindrome

Other Links

  • C Programming - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW