by Dinesh Thakur Category: C Programming (Pratical)

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.

  1. Enter the value.
  2. Declare Function.
  3. Call the Function.
  4. 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


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.