KodeGod.com

060. Write a program to accept two numbers from user and print it’s addition,subtraction,multiplication,division using different functions in C language


#include<stdio.h>
#include<conio.h>  

int add(int x,int y)
{
 return(x+y);
}

int sub(int x,int y)
{
 return(x-y);
}

int mul(int x,int y)
{
 return(x*y);
}

int div(int x,int y)
{
 return(x/y);
}

main()
{
	int a,b;
	clrscr();
	printf("Enter numbers : \n");
	scanf("%d%d",&a,&b);
	printf("\nAddition       : %d\n",add(a,b));
	printf("\nSubtraction    : %d\n",sub(a,b));
	printf("\nMultiplication : %d\n",mul(a,b));
	printf("\nDivision       : %d\n",div(a,b));
getch();
}