Home C Language Basic C Programs Perform arithmetic operations

Perform arithmetic operations

Arithmetic operators example program in c.

write a c program to demonstrate arithmetic operations.

#include<stdio.h>

int main()

{

   int a,b,c;

   printf(“Enter two values : \n”);

   scanf(“%d %d”,&a,&b);

   c=a+b;

   printf(“Addtion of two numbers is : %d\n”,c);

   c=a-b;

   printf(“substraction of two numbers is : %d\n”,c);

   c=a*b;

   printf(“multiplication of two numbers is : %d\n”,c);

   c=a/b;

   printf(“Division of two numbers is : %d\n”,c);

   c=a%b;

   printf(“Module division of two numbers is : %d\n”,c);

   return 0;

}

Output:

Enter two values :

12

4

Addition of two numbers is : 16

subtraction of two numbers is : 8

multiplication of two numbers is : 48

Division of two numbers is : 3

Module division of two numbers is : 0