Friday, 4 April 2014

How to Subtract Two Numbers in C Language Program

Subtraction in C Programs is very easy as it is in Addition because both are on same pattern and syntax for both is same. Just one operation is different and that is minus. I have put all my efforts while creating this blog. However there are lots of other blogs websites are available for online learning of C Language programs but almost all are based on same complex method of teaching. But my teaching method id quite different as you can see

C Program to Subtract Two Numbers

#include<stdio.h>
main()
{
     int var1,var2,answer;
     printf("\nEnter First Value:= ");
     scanf( "%d",&var1);

     printf("\nEnter Second Value:= ");
     scanf( "%d",&var2);

     answer=var1-var2;
     printf("\Answer Is:= %d ",answer);
}

Output of the program

Output for Subtraction

No comments:

Post a Comment