Program to find subtraction of two numbers using c programming language

C Programming Language / Fundamentals of C Language

5609

Program:

#include"stdio.h" 
 void main()
	{
        // variable declaration
	int num1, num2, subResult; 

	printf("Enter two no: ");
 	scanf("%d%d",&num1,&num2);
	subResult = num1 - num2;

       // Print result
       printf("subtraction result =%d \n", subResult);
    
}

Output:

Enter two no: 6 3
sum=3
Press any key to continue . . .

Explanation:

Algorithm:

  • Step 1: Start
  • Step 2: Declare variable number 1, number 2 and subResult
  • Step 3: Read Variable number 1, number 2
  • Step 4: Perform operation (subResult = num1 - num2)
  • Step 5: Print subResult variable
  • Step 7: Stop

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.