C Program to Add Two Numbers Using Function

In this program, you'll learn to add two numbers using function. A function is a block of statements that performs a specific task. Let's say you are writing a C program and you need to perform a same task in that program more than once. In such case you have two options: a) Use the same set of statements every time you want to perform the task. b) Create a function to perform that task, and just call it every time you need to perform that task.



Source Code
#include<stdio.h>
#include<conio.h>
void add(int, int);
void main()
{
    int a, b;
    //clrscr();
    printf("Enter two number: ");
    scanf("%d%d",&a,&b);
    add(a,b);
    getch();
}
void add(int a, int b)
{
    printf("Addition of %d and %d is %d", a, b, a+b);
}
Output
Enter two number: 12 68
Addition of 12 and 68 is 80