Arithmetic Operators in C
  • Twitter
  • Facebook
  • Snapchat
  • Instagram

Arithmetic Operators in C Programming: Complete Guide

📑 On this page:
  • What are Operators, Operands & Expressions?
  • Types of Arithmetic Operators
  • Addition Operator (+)
  • Subtraction Operator (-)
  • Multiplication Operator (*)
  • Division Operator (/)
  • Modulus Operator (%)
  • Complete Program Example
  • Frequently Asked Questions
📚 In this tutorial, you will learn:
  • What are operators, operands, and expressions in C
  • What are arithmetic operators and how they work
  • How to use addition, subtraction, multiplication, division, and modulus operators
  • What is integer division and why it matters
  • How to write programs using arithmetic operators

What are Operators, Operands & Expressions?

Operators are special symbols that perform specific operations on one or more operands. Think of them like verbs in a sentence — they do the action. Examples: +, -, *, /, %.

An expression is a combination of operators and operands that produces a value. For example, a + b is an expression where + is the operator and a, b are operands.

💡 Quick Definition: An operator is a symbol that performs an operation. An expression is a combination of operators and operands that yields a value.

C supports 8 types of operators:

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Assignment Operators
  • Bitwise Operators
  • Increment/Decrement Operators
  • Special Operators
  • Conditional Operator
Arithmetic Operators in C

Types of Arithmetic Operators

C provides 5 binary arithmetic operators. These operators work on two operands:

Operator Symbol Example Description
Addition+a + bAdds two numbers
Subtraction-a - bSubtracts second number from first
Multiplication*a * bMultiplies two numbers
Division/a / bDivides first number by second
Modulus%a % bReturns the remainder after division

1. Addition Operator (+)

The addition operator is used to add two numbers or variables.

Syntax: result = operand1 + operand2;

Example: z = x + y;

2. Subtraction Operator (-)

The subtraction operator subtracts the second operand from the first.

Syntax: result = operand1 - operand2;

Example: z = x - y;

3. Multiplication Operator (*)

The multiplication operator multiplies two numbers.

Syntax: result = operand1 * operand2;

Example: z = x * y;

4. Division Operator (/)

The division operator divides the first operand by the second.

Syntax: result = operand1 / operand2;

Example: z = x / y;

⚠️ Important: In C, if both operands are integers, the result is an integer (decimal part is truncated). To get a precise result, at least one operand must be a float or double.

5. Modulus Operator (%)

The modulus operator returns the remainder when the first operand is divided by the second.

Syntax: result = operand1 % operand2;

Example: z = x % y;

The modulus operator is especially useful for:

  • Checking if a number is even or odd
  • Finding if a number is divisible by another
  • Working with cyclic operations (like clock arithmetic)

Complete Program Example

Example: Arithmetic Operators in C

#include <stdio.h>

int main() {
    int x = 9, y = 4, z;

    // Addition
    z = x + y;
    printf("x + y = %d \n", z);

    // Subtraction
    z = x - y;
    printf("x - y = %d \n", z);

    // Multiplication
    z = x * y;
    printf("x * y = %d \n", z);

    // Division
    z = x / y;
    printf("x / y = %d \n", z);

    // Modulus
    z = x % y;
    printf("Remainder when %d divided by %d = %d \n", x, y, z);

    return 0;
}
                                    

Expected Output:

x + y = 13
x - y = 5
x * y = 36
x / y = 2
Remainder when 9 divided by 4 = 1
                                    

Program Explanation

Let's break down this program line by line to understand what's happening:

1. Inclusion of Header File:

#include <stdio.h>
                                

This includes the standard input/output library, which provides functions like printf() to display output.

2. Variable Declaration:

int x = 9, y = 4, z;
                                

x is initialized with 9, y with 4, and z is left uninitialized to store results.

3. Addition Operation:

z = x + y;
printf("x + y = %d \n", z);
                                

Adds 9 and 4 to get 13, stores in z, and prints the result.

4. Subtraction Operation:

z = x - y;
printf("x - y = %d \n", z);
                                

Subtracts 4 from 9 to get 5, stores in z, and prints the result.

5. Multiplication Operation:

z = x * y;
printf("x * y = %d \n", z);
                                

Multiplies 9 and 4 to get 36, stores in z, and prints the result.

6. Division Operation (Integer Division):

z = x / y;
printf("x / y = %d \n", z);
                                

Divides 9 by 4. Since both are integers, the result is an integer — 2, not 2.25. The decimal part is truncated.

7. Modulus Operation:

z = x % y;
printf("Remainder when %d divided by %d = %d \n", x, y, z);
                                

Returns the remainder when 9 is divided by 4, which is 1.

8. Return Statement:

return 0;
                                

Indicates that the program executed successfully and returns control to the operating system.

Summary of Arithmetic Operators

Operator Symbol Function Example
Addition+Add two numbers5 + 3 = 8
Subtraction-Subtract Second from First5 - 3 = 2
Multiplication*Multiply two numbers5 * 3 = 15
Division/Divide & return quotient5 / 3 = 1
Modulus%Returns the remainder5 % 3 = 2

🎯 Key Takeaway: Arithmetic operators are the building blocks of mathematical operations in C. They are used in billing systems, games, reports, financial applications, IoT sensors — everywhere calculations are needed.

Frequently Asked Questions About Arithmetic Operators

1. What is the difference between / and % in C?

/ is the division operator that returns the quotient. % is the modulus operator that returns the remainder after division.

2. Why does 9/4 give 2 instead of 2.25 in C?

This is called integer division. When both operands are integers, C performs integer division and truncates the decimal part.

3. How can I get the exact decimal result in division?

Make at least one operand a float or double. For example: 9.0 / 4 or (float)9 / 4.

4. Where are arithmetic operators used in real life?

Arithmetic operators are used everywhere — billing systems, game development, financial applications, scientific calculations, IoT sensors, and more.

💡 Tip: Practice writing programs with all five arithmetic operators to build a strong foundation in C programming.

📖 Related Tutorials

  • Assignment Operators in C
  • Increment and Decrement Operators
  • Relational Operators in C
  • Logical Operators in C

Previous Topic: -->> Introduction to C Assignments   ||   Next topic: -->> Assignment Operators


📚 Explore More Topics

🗄️ SQL Interview Questions & Answers

SQL SELECT Statement FAQ SQL Restricting & Sorting Data FAQ SQL Group Functions & Aggregated Data FAQ SQL Multiple Tables (JOINs) FAQ SQL Subqueries FAQ SQL DML Statements (Managing Tables) FAQ SQL Indexes, Synonyms & Sequences FAQ SQL DDL (Tables & Relationships) FAQ SQL Views FAQ SQL Indexing Best Practices FAQ SQL Window & Analytic Functions FAQ

🐍 Python Interview Questions & Answers

Python Interview Questions Python Syntax & Variables FAQ Python Data Types FAQ Python If-Else FAQ Python Loops FAQ Python Functions Interview Q Python String Manipulation FAQ Python Lists & Dictionaries FAQ Python Tuples & Sets FAQ Python Exception Handling FAQ Python OOP Interview Questions

☕ Java Interview Questions & Answers

Java Introduction Interview Q Java Development Environment FAQ Java Data Types FAQ Java Control Flow & Operators FAQ Java Basic Input/Output FAQ Java Arrays FAQ Java Strings FAQ Java Methods FAQ Java Basic OOP Concepts FAQ Java Advanced OOP Concepts FAQ Java OOP Best Practices FAQ Java Exception Handling FAQ Java Synchronization FAQ Java Threads & Concurrency FAQ Java Collection Framework FAQ Java File I/O & Serialization FAQ Java Serialization & Deserialization FAQ Java Features FAQ Java Inner & Anonymous Classes FAQ Java Memory Management FAQ Java Packages FAQ Java Wrapper Classes FAQ Java Streams & Lambda FAQ

C Language

  • Home
  • Why C Language
  • History of C Language
  • Applications of C Language
  • Introduction To C
    • What is Program?
    • Structure of C Program
    • Working Of C Program
    • CHARACTER SET
    • VARIABLES AND IDENTIFIERS
    • BUILT-IN DATA TYPES
    • OPERATORS AND EXPRESSIONS
    • CONSTANTS AND LITERALS
    • SIMPLE ASSIGNMENT STATEMENT
    • BASIC INPUT/OUTPUT STATEMENT
    • SIMPLE 'C' PROGRAMS
    • Assignments
  • Operators in C Programming
    • Arithmetic Operators
    • Assignment Operators
    • Increment and Decrement Operators
    • Relational Operators
    • Logical Operators
    • Bitwise Operators
    • Other Operators
    • Assignments
  • Conditional Statements
    • DECISION MAKING WITHIN A PROGRAM
    • CONDITIONS
    • IF STATEMENT
    • IF-ELSE STATEMENT
    • IF-ELSE LADDER
    • NESTED IF-ELSE
    • SWITCH CASE
    • Assignments
  • Loops Statements
    • Introduction to Loops
    • GO TO Statement
    • Do while Loop
    • While Loop
    • Nested While Loop
    • Difference Between While and Do while
    • Difference Between Goto and loop
    • while loop assignments
    • C FOR Loop
    • C For loop examples
    • Nested for loop
    • Nested for loop examples
    • Infinite while Loops
    • Infinite for Loops
    • Continue in Loops
    • break in Loops
    • difference while do..while & for
    • Assignments
  • Arrays
    • One Dimensional Array
    • Declaring 1D Arrays
    • Initilization of 1D arrays
    • Accessing element of one 1D Array
    • Read and Display 1D Arrays
    • Two Dimensional Arrays
    • Declare 2D Arrays
    • Read and Display 2D Arrays
    • Assignments/Examples
  • Functions
    • Introduction
    • Need For User-Defined Function
    • Multiple Function Program
    • Modular Programming
    • Elements Of User Defined Function
    • Function Definition
    • Function Declaration
    • Types of functions
    • Nesting of Function
    • Recursion
    • Passing Array To Functions
    • Scope,Visibility and Lifetime of Variables
    • Assignments
  • Structure
    • Introduction
    • Array vs Structure
    • Defining Structure
    • Declaring Structure Variables
    • Type Defined Structure
    • Accessing Structure Members
    • Structure Initilization
    • Copying & Comparing Structure Variables
    • Array of Structure
    • Arrays Within Structure
    • Structures Within Structures
    • Structures and Functions
    • Structure Examples/Assignments
  • Union
    • Define Union
    • Create and use Union
    • Difference Between Structure and Union
    • Union Examples
    • Union FAQ
  • Pointers
    • What Are Pointers In C?
    • How Do We Use Pointers In C?
    • Declaration Of A Pointer
    • The Initialization Of A Pointer
    • Syntax Of Pointer Initialization
    • Use Of Pointers In C
    • The Pointer To An Array
    • The Pointer To A Function
    • The Pointer To A Structure
    • Types Of Pointers
    • The Null Pointer
    • The Void Pointer
    • The Wild Pointer
    • The Near Pointer
    • The Huge Pointer
    • The far Pointer
    • dangling pointer
    • Accessing Pointers- Indirectly And Directly
    • Pros Of Using Pointers In C
    • Cons Of Pointers In C
    • Applications Of Pointers In C
    • The & Address Of Operator In C
    • How To Read The Complex Pointers In C?
    • Practice Problems On Pointers
  • File Processing
    • File Handling In C
    • Types Of Files In C
    • Operations Done In File Handling
    • File Examples
    • Binary Files
    • count words,lines in a file
    • Copy files
    • Update File
    • count vowels in a file
  • Preprocessor
    • Macro substitution division
    • File Inclusion
    • Conditional Compilation
    • Other directives
    • Examples
  • Dynamic Memory Allocation
    • malloc
    • calloc
    • free
    • realloc
    • Examples
  • Storage Classes
  • Graphics
  • Frequently Asked Interview Questions (FAQ)
    • Introduction To C FAQ
    • Operators FAQ
    • Conditional Statements FAQ
    • Loops FAQ
    • Arrays FAQ
    • Function FAQ
    • Structure FAQ
    • Pointers FAQ
    • Files FAQ
    • Storage classes FAQ
    • Dynamic Memory FAQ
  • Programs/Assignments
    • Introduction To C
    • Operators
    • Conditional Statements
    • Loops
    • Arrays
    • Function
    • Structure
    • Pointers
    • Files
    • Storage classes
    • Dynamic Memory
  • Case Studies
  • Multiple Choice Questions
    • Introduction To C MCQ
    • Operators MCQ
    • Conditional Statements MCQ
    • Loops MCQ
    • Arrays MCQ
    • Function MCQ
    • Structure MCQ
    • Pointers MCQ
    • Files MCQ
    • Storage classes MCQ
    • Dynamic Memory MCQ
    • More MCQ

Get in touch

  • tech2dsm@gmail.com

© Sankalan Data Tech. All rights reserved.