Program 4: Design a function sum, which takes two integer values inside the body of sum function and make addition and return addition to calling function. And calling function print the addition of two numbers. (C function without arguments and with return value or return type)
#include < stdio.h >
#include< conio.h >
void main ()
{
int c;
int sum ();
c= sum ();
printf(“\n Addition is =%d ”,c);
getch();
}
int sum ()
{
int a, b;
printf(“\n Enter two number ”);
scanf(“%d %d ”& a, &b);
c=a + b;
return c;
}
Output:
Enter two number
21
31
Addition is =52
0 Comments