
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
Explain the concept of Arithmetic operators in C language
It is used to perform the arithmetic operations like addition, subtraction etc.
Operator | Description | Example | a=20,b=10 | Output |
---|---|---|---|---|
+ | Addition | a+b | 20+10 | 30 |
- | subtraction | a-b | 20-10 | 10 |
* | multiplication | a*b | 20*10 | 200 |
/ | Division | a/b | 20/10 | 2(quotient) |
% | Modular Division | a%b | 20%10 | 0 (remainder) |
Algorithm
Follow the algorithm mentioned below −
START Step 1: Declare integer variables. Step 2: Read all variables at runtime. Step 3: Perform arithmetic operations. i. a+b ii. a-b iii. a*b iv. b/a v. a%b Step 4: Print all computed values.
Program
Following is the C program to compute arithmetic operators −
#include<stdio.h> main (){ int a,b; printf("enter a,b:
"); scanf("%d%d",&a,&b); printf("a+b=%d
",a+b); printf("a-b=%d
",a-b); printf("a*b=%d
",a*b); printf("b/a=%d
",b/a); printf("a%b=%d
",a%b); }
Output
You will see the following output −
enter a,b: 40 60 a+b=100 a-b=-20 a*b=2400 b/a=1 ab=40
- Related Articles
- Explain the concept of pointers in C language
- Explain the concept of Sorting in C language
- Explain the concept of stack in C language
- Explain the concept of pointer accessing in C language
- Explain the concept of Linked list in C language
- Explain the concept of union of structures in C language
- Explain the concept of Uninitialized array accessing in C language
- Explain Arithmetic operations using pointers in C language?
- Explain the concept of logical and assignment operator in C language
- Arithmetic Operators in C++
- Explain the concept of pointer to pointer and void pointer in C language?
- Explain bit field in C language by using structure concept
- What are arithmetic operators in C#?
- Explain the concept of one and two dimensional array processing using C language
- Simple Arithmetic Operators Example Program In C++

Advertisements