program to find the Difference of two numbers

//program to find the Difference of two numbers
#include<stdio.h>
#include<conio.h>
int main()
{
int a,b,dif;
clrscr();
printf("Enter Two Numbers\n");
scanf("\n%d\n%d",&a,&b);
dif=a-b;
printf("\nDifference is =%d",dif);
getch();
return 0;
}

To Run this Program Copy it in text editor and save as .c
Then double click on it and then it will get opened in your compiler.
Click on run.

2 comments:

  1. #include
    int main()
    {
    int a,b,diff;
    printf("Enter the first number: ");
    scanf("%d",&a);
    printf("Enter the second number: ");
    scanf("%d",&b);
    if(a>b)
    diff = a-b;
    else
    diff = b-a;
    printf("Difference between %d and %d is:%d",a,b,diff);
    return 0;
    }

    ReplyDelete
  2. #include
    int main()
    {
    int a,b,diff;
    printf("Enter the first number: ");
    scanf("%d",&a);
    printf("Enter the second number: ");
    scanf("%d",&b);
    if(a>b)
    diff = a-b;
    else
    diff = b-a;
    printf("Difference between %d and %d is:%d",a,b,diff);
    return 0;
    }

    ReplyDelete