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.
#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("Sum is:%d", s);
return 0;
}
Output:
Enter two numbers:10 20
Sum is:30