Thursday, 28 August 2014

Write a program to substract two numbers.

SOURCE CODE

//WAP to substract two numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, sub ;
   printf("SUBSTRACT TWO NUMBERS\n\n") ;
   printf("Enter the value of A : ") ;
   scanf("%d", &a) ;
   printf("Enter the value of b : ") ;
   scanf("%d", &b) ;
   sub=a-b ;
   printf("\nThe substraction of %d and %d is %d.", a,b,sub) ;
   getch() ;
}


SCREENSHOT



NOTE : You can do multiplication, division and modulus simply replace the minus operator with *, / or % respectively from the process part. For more help go to the calculator program.

No comments:

Post a Comment