C Program to Add Two Numbers Using Functions

C Program to add two numbers using functions for beginners to understand the function concepts in a c programming language. 

Function Definition in C

A function is a collection of statements that work together to complete a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions. 

The name, return type, and parameters of a function are all specified in a function declaration. In mathematics, a function is an expression, rule, or law that defines a relationship between two variables. 

In mathematics, functions are everywhere, and they’re crucial for formulating physical relationships in the sciences.

Types of Function in C

Category I: Functions with no arguments and no return values.

Category 2: Functions with no arguments and with return values.

Category 3: Functions with arguments and no return values.

Category 4: Functions with arguments and with return values.

stdlib.h in C Program

h is the header of the C programming language’s general-purpose standard library, which includes functions for memory allocation, process control, conversions, and more. This is sample method to execute c program to add two numbers using functions

#include <stdio.h>
#include <stdlib.h>
int sum(int , int);
int main()
{
int a,b,Output;
printf("Enter Two Number");
scanf("%d %d",&a,&b);
Output=sum(a,b);
printf("Sum of Two Numbers%d",Output);
return 0;
}
int sum(int a, int b)
{
int result=a+b;
return result;
}

Output:

Enter Two Number

45
45
Sum of Two Numbers

90