C Language

May 20, 2023

How to use Arithmetic operators in C Language

  • Program to use Arithmetic operators in C Language

    
    #include <stdio.h>
    int main()
    {
        int a = 17, b = 4;
        printf("sum=%d\n", a + b);
        printf("defference=%d\n", a - b);
        printf("proudct=%d\n", a * b);
        printf("quotient=%d\n", a / b);
        printf("remainder=%d\n", a % b);
        return 0;
    }
    

    output

    
    sum=21
    difference=13
    product=68
    quotient=4
    remainder=1
    

    Step / Description

    1. Declare integer variable a and b
    2. Initialize int integer variable a = 17, b = 4
    3. printf inbuild function to display sum of variable a and b with decimal place holder %d
    4. printf inbuild function to display difference of variable a and b with decimal place holder%d
    5. printf inbuild function to display product of variable a and b with decimal place holder %d
    6. printf inbuild function to display quotient of variable a and b with place holder %d
    7. printf inbuild function to display remainder of variable a and b with decimal place holder %d

    by : Nadeem Khan

    Quick Summary:

    Arithmetic Operators