Function with arguments and with return value - C Programming
Program to send values to user‒define function and receive the values from user‒define function.
/* Program to send and receives the values from function */
#include <stdio.h>
#include <conio.h>
void main()
{
int mul(int, int), m, n,sum; /* Local definitions */
/* Statements */
clrscr();
printf("Enter the two numbers: ");
scanf("%d %d", &m,&n);
sum=mul(m,n); /* call function */
printf("Multiplication of entered values is: %d", sum);
getch();
} /* main */
mul(int m, int n)
{
return(m*n);
} /* mul */
OUTPUT
Enter the two numbers: 30 4
Multiplication of entered values is: 120
EXPLANATION: In this program the function mul() receives three values from main function. The mul() function calculates the multiplication of two values and return the result to the main program.
Computer Programming C Laboratory: Functions C Programs : Tag: C Programming : - Program to send values to user‒define function and receive the values from user‒define function (Function with arguments and with return value)