This is C Program Find Sum of Two number Through Function. In this program user asks to find the sum 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 ask the numbers which are use to add. Then it declares a function sum (a,b). The next move it call the function sum with formal arguments int x, int y and int z=x+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 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;
clrscr();
printf("Enter Two Number : ");
scanf("%d%d",&a,&b);
sum(a,b);
getch();
}
sum(int x,int y)
{
int z;
z=x+y;
printf("Sum of Two Number is : %d",z);
return 0;
}
Output :
Enter Two Number : 10 20
Sum of Two Number is : 30