Write a
program to calculate the Subtraction and addition of two numbers by using
functions.
#include<stdio.h>
#include<conio.h>
int sum(int,
int);
int sub(int,
int);
int main()
{
int a, b, c, d;
clrscr();
printf("
Enter the two numbers");
scanf("%d%d",&a,&b);
c=sum(a, b);
d=sub(a, b);
printf("The
sum of the number is %d and the difference is %d",c,d);
getch();
return(0);
}
int sum(int x,
int y)
{
int z;
z=x+y;
return(z);
}
int sub(int x,
int y)
{
int z;
z=x-y;
return(z);
}
OUTPUT:
Enter the two
numbers 8 4
The sum of the
number is 12 and the difference is 4
No comments:
Post a Comment