Addition, subtraction, multiplication and division of two numbers in c programming

Addition, subtraction, multiplication and division of two numbers in c programming

In this post we will show you how to Addition, subtraction, multiplication and division of two numbers in c programming. flowing code will help you to perform program.

// include header file 
# include <stdio.h>
# include <conio.h>
// main function
void main()
{
	
	int a,b;
	int sum,sub,mul;
	float div;
	clrscr();

	printf("Enter 1st Number: ");
	scanf("%d",&a);
	printf("Enter 2nd Number: ");
	scanf("%d",&b);
	
	// Addition of a and b	
	sum=a+b;
	// subtraction of a and b
	sub=a-b;
	// multiplication of a and b 
	mul=a*b;
	// division of a and b
	div=(float)a/b; 
	// (float) - will convert a/b into a float value.

	printf("\nAddition: %d",sum);
	printf("\nSubtraction: %d",sub);
	printf("\nMultiplication: %d",mul);
	printf("\nDivision: %0.2f",div);
	getch();
}

Leave a Comment

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

53  +    =  62

We accept paid advance and paid guest Posting on our Site : Contact US