C Program to Multiply Two Numbers

This program demonstrates how to multiply two numbers in C, an essential operation for beginners learning arithmetic and input-output functions.

In this tutorial, you’ll learn how to write a C program to take two numbers as input, multiply them, and display the result.

Concept Overview

C programming allows arithmetic operations using basic operators. The '*' operator is used to multiply two numbers.

Program

#include <stdio.h>

int main() {
    int num1, num2, product;

    // Ask the user to enter two numbers
    printf("Enter first number: ");
    scanf("%d", &num1);

    printf("Enter second number: ");
    scanf("%d", &num2);

    // Perform multiplication
    product = num1 * num2;

    // Display the result
    printf("Product = %d\n", product);

    return 0;
}

Output

Enter first number: 5
Enter second number: 4
Product = 20

Explanation