C Program to perform Arithmetic Operations

C Program to perform Arithmetic Operations

 How can we make a calculator in C language? Here we are using arithmetic operators to calculate and "printf" method to print the result.

Addition of two numbers in C :

int main()
   int first, second, add, subtract, multiply, modulo;
   float divide;
   printf("Enter two numbers : \n");
   scanf("%d%d", &first, &second);
   add = first + second;
   subtract = first - second;
   multiply = first * second;
   divide = first / (float)second;
   modulo =  first % second;

   printf("Sum = %d\n", add);
   printf("Difference = %d\n", subtract);
   printf("Multiplication = %d\n", multiply);
   printf("Division = %f\n", divide);
   printf("Modulo Division = %d\n", modulo);
   return 0;

Output :