C Program to Add, Subtract, Multiply and Divide Two Integers

  • Tech Area
  • April 22, 2024



In this tutorial, We will add, subtract, multiply and divide in C programming language.

Program to Add Two Integers

#include<stdio.h>
#include<conio.h>
void main()
{
int a = 20;
int b = 10;
int c = a + b;
printf("%d + %d = %d", a, b, c);
getch();
}

Output

20 + 10 = 30

Program to Subtract Two Integers

#include<stdio.h>
#include<conio.h>
void main()
{
int a = 20;
int b = 10;
int c = a - b;
printf("%d - %d = %d", a, b, c);
getch();
}

Output

20 - 10 = 10

Program to Multiply Two Integers

#include<stdio.h>
#include<conio.h>
void main()
{
int a = 20;
int b = 10;
int c = a * b;
printf("%d * %d = %d", a, b, c);
getch();
}

Output

20 * 10 = 200

Program to Divide Integer

#include<stdio.h>
#include<conio.h>
void main()
{
int a = 20;
int b = 10;
int c = a / b;
printf("%d / %d = %d", a, b, c);
getch();
}

Output

20 / 10 = 2


Subscribe us via Email

Join 10,000+ subscriber