C Program to perform all arithmetic operations


Introduction

C Program to perform arithmetic operations. I have used Code:: Blocks compiler for debugging purpose. But you can use any C programming language compiler as per your availability.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>

int main()
{
    int num1, num2;
    int sum, sub, mult, mod;
    float div;

    printf("Enter first number : ");
    scanf("%d", &num1);

    printf("Enter second number : ");
    scanf("%d", &num2);

    sum = num1 + num2;
    sub = num1 - num2;
    mult = num1 * num2;
    mod = num1 % num2;
    div = (float)num1 / num2;


    printf("Sum of num1 and num2 = %d \n", sum);
    printf("Difference of num1 and num2 = %d \n", sub);
    printf("Product of num1 and num2 = %d \n", mult);
    printf("Modulus of num1 and num2 = %d \n", mod);
    printf("Quotient of num1 and num2 = %f ", div);


    return 0;
}

Result

C language

     





Related Topics




Popular Posts