In this program user asks to find the sum, division, multiply of two numbers with use of function in other words Polymorphism. The function calling procedure will use in this program to find the sum of two numbers. First user asks the numbers which are use to add, divide or multi. Then it declares a function sum, multi, divide (a,b). The next move it call the function sum with formal arguments int x, int y in this procedure the value call from the upper class but add in other class. And in the last the result print on the screen.
Problem Statement:
In this program the user asks to find the sum of two numbers through function.
- Enter the value.
- Declare Function.
- Call the Function.
- Display result on the screen.
Here is source code of the C program that Find the sum, multi, division of two numbers through function. The C program is successfully compiled. The program output is also shown below.
#include<stdio.h>
void main()
{
int a,b,c,d,e,f;
clrscr();
printf("Enter Two Values :");
scanf("%d%d",&a,&b);
sum(a,b);
mult(a,b);
div(a,b);
getch();
}
sum(int x,int y)
{
int z;
z=x+y;
printf("Addtion : %d\n",z);
return 0;
}
mult(int x,int y)
{
int z;
z=x*y;
printf("Multiply : %d\n",z);
return 0;
}
div(int x,int y)
{
int z;
z=x/y;
printf("Div : %d\n",z);
return 0;
}