How to use function find the sum of two numbers

Function Find the Sum of Two Numbers

On this page

Function

Program to use Function Find the Sum of Two Numbers

#include <stdio.h>
int sum(int x, int y);
int main(void)
{
    int a = 10, b = 20, k;
    k = sum(a, b); /*Function call*/
    printf("%d\n", k);
    k = sum(4, 5); /*Function call*/
    printf("%d\n", k);
    k = sum(a + b, b * 2); /*function call*/
    printf("%d\n", k);
    return 0;
}
int sum(int x, int y)
{
    int s;
    s = x + y;
    return s;
}

Output

30
9
70