Saturday, March 23, 2019

WRITE A PROGRAM FOR ADDITION AND SUBTRACTION FOR TWO VALUES


BACHELOR OF COMPUTER APPLICATION (B.C.A.) FIRST SEMESTER


Here you will get simple C program 
WRITE A PROGRAM FOR ADDITION AND SUBTRACTION FOR TWO VALUES
IT IS THE SMALLEST LOGIC USED FOR CODING OF THIS PROGRAM.
IN WHICH YOU CAN CREATE OWN VARIABLES AND FUNCTIONS.
User will input two numbers,
then their addition and subtraction will be calculated and
finally it will be printed on screen.

The program coding is given below.
#include<stdio.h>
#include<conio.h>
int main()
{
 int a,b,c;
 printf("Enter a= ");
 scanf("%d",&a);
 printf("Enter b= ");
 scanf("%d",&b);
 c=a+b;
 printf("\nAdd=%d",c);
  c=a-b;
  printf("\nSub=%d",c);
 getch();
 return 0;
}
Output will be given after you compile it.

No comments:

Post a Comment