Basic

Switch Case

Goto

Operators

if Statement

Nested if

While Loop

For Loop

Array

Patterns

Excersises


Arithmetic Operators in C Program


The following table shows, how to use Arithmetic operators in c Program.

Operator Description
+ Addition (Unary Plus)
- Subtraction (Unary Minus)
* Multiplication
/ Division
/ Modulo division

Example : pgm.c

#include<stdio.h>

int main(){

    int a=10,b=6,c;

    c=a+b;
    printf("\na+b = %d",c);

    c=a-b;
    printf("\na-b = %d",c);

    c=a*b;
    printf("\na*b = %d",c);

    c=a/b;
    printf("\na/b = %d",c);

    c=a%b;
    printf("\na%b = %d",c);

    return 0;
}

Output:

a+b : 16
a-b : 4
a*b : 60
a/b : 1
a%b : 4