How to use find the sum of two numbers in C Language
Sum of 2 numbers
On this page
Sum Function
#include <stdio.h>
int sum(int x, int y) /*function definition*/
{
int s;
s = x + y;
rextturn s;
}
int main(void)
{
int a, b, s;
printf("Enter values for a and b : ");
scanf("%d %d", &a, &b);
s = sum(a, b); /*function call*/
printf("Sum of %d and %d is %d\n", a, b, s);
return 0;
}
Output
Enter value for a and b :12
6
Sum of 12 and 6 is 18