Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to do subtraction of two numbers

Posted By: Hayden Evans     Category: C Programming     Views: 5959

Write a Program to do subtraction of two numbers.

Code for Program to do subtraction of two numbers in C Programming

#include <stdio.h>

void main()
{


int number1,number2,number3;

printf("Enter the first number:");
if(scanf("%d",&number1)==1)
{
        printf("Enter the second number:");
        if(scanf("%d",&number2)==1)
        {
                number3=number1-number2;
                printf("The subtraction is :%d",number3);
        }
        else
        {
                printf("Error,enter correct value");
        }
}
else
{
        printf("Error,enter correct value");
}
}

========================================OUTPUT=================================
Enter the first number:34
Enter the second number:33
The subtraction is :1
  
Share: 


Didn't find what you were looking for? Find more on Program to do subtraction of two numbers Or get search suggestion and latest updates.

Hayden Evans
Hayden Evans author of Program to do subtraction of two numbers is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!