C Program for function with argument and return value


In this program, You will learn how to create a function with argument and return value in C.


int sum(int x, int y) {

return x + y; }


Example: How to create a function with argument and return value in C

Run it Now
#include<stdio.h>

int sum(int x, int y) {
    int z;
    z = x + y;
   return z;
}

int main() {

   int x, y, s;

   printf("Enter two numbers :");
   scanf("%d%d", &x, &y);

   s = sum(x, y);
   printf("\nSum is :%d", s);

   return 0;
}

Output:

Enter two numbers :13 14
Sum is :27