C Program to Find Product of Numbers Using Function

In this program, you'll learn to find product of two numbers using function. A function is a block of statements that performs a specific task. Let's say you are writing a C program and you need to perform a same task in that program more than once. In such case you have two options: a) Use the same set of statements every time you want to perform the task. b) Create a function to perform that task, and just call it every time you need to perform that task.

Source Code
long product(int, int);
void main()
    int a, b, p;
    printf("Enter the values of a & b: ");
    scanf("%d%d", &a, &b);
    p = product(a, b);
    printf("Product of %d and %d = %d", a, b, p);
long product(int x, int y)
    return x*y;
Enter the values of a & b: 42 50
Product of 42 and 50 = 2100

"Coding Hub - Learn to code" app now available on Google Play Store