Program to return a value from user-defined function.
#include <stdio.h>
#include <conio.h>
int sum ();
void main()
{
int a, b, c;
clrscr();
printf ("Enter two integer values to add: ");
scanf ("%d%d", &a, &b);
c = sum (a, b);
printf ("The addition is: %d", c);
getch();
}
int sum (int x, int y)
{
int add;
add = x + y;
return add;
}
#include <stdio.h>
#include <conio.h>
int sum ();
void main()
{
int a, b, c;
clrscr();
printf ("Enter two integer values to add: ");
scanf ("%d%d", &a, &b);
c = sum (a, b);
printf ("The addition is: %d", c);
getch();
}
int sum (int x, int y)
{
int add;
add = x + y;
return add;
}