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

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 */
#include<stdio.h>
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");
     scanf("%d%d",&a,&b);

     sum=a+b;
     sub=a-b;
     mul=a*b;
     division=(float)a/b;
     rem=a%b;

     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);
     getch();
     }

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

yashan has written 70 articles

5 thoughts on “C Program to find sum, multiply, divide and remainder of two numbers

    1. yashan says:

      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…

Cancel reply

Leave a Reply to jeeva khan

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>