Write a program to find the sum of two numbers using user defined function which returns value

//this is a program to find the sum of two numbers using user defined function
#include<stdio.h>
#include<conio.h>
int sum(int x,int y);
void main()
{
int a,b,add;

printf("\n\nEnter any two numbers: ");
scanf("%d%d",&a,&b);

add=sum(a,b);

printf("\n\nSum=%d",add);
getch();
}
int sum(int x, int y)
{
int sum;
sum=x+y;
return sum;
}

Previous
Next Post »