Skip to content

C Program to find sum, multiply, divide and remainder of two numbers

by yashan on August 18th, 2011

Make a simple C program to find the sum (addition), multiply, subtract, divide and remainder of two numbers. C program will be as follows -

/*C program to find remainder(modulus), sum, subtract, multiply and divide two numbers */
void main()
     int a,b,sum,sub,mul,rem;
     float division;

     printf("Enter any two numbers a and b to sum, subtract, multiply, divide and find remainder of these two numbers\n");


     printf("\n Sum of %d and %d is \t %d",a,b,sum);
     printf("\n Subtraction of %d and %d is \t %d",a,b,sub);
     printf("\n Multiplication of %d and %d is \t %d",a,b,mul);
     printf("\n Division of %d and %d is \t %f",a,b,division);
     printf("\n remainder of %d and %d is \t %d",a,b,rem);

Input – Enter any two numbers- 5   4
Output -
Sum is  - 9
Subtraction – 1
Multiplication – 20
Division – 1.25
Modulus is 1

  1. please……………. learn do you c me

  2. Soman Khan permalink

    What if a is any number and b is zerO?

    please reply me im stuck on this problem…

    • yashan permalink

      If any number is zero then it will perform operations with zero only. It’s simple. Like an example -

      a = 5 and b = 0
      sum = 5
      subtraction = 5
      multiplication = 0
      and so on…

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS