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

C
#include <stdio.h>

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

    printf("Enter first number: ");
    scanf("%d", &num1);

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

    product = num1 * num2;

    printf("Product = %d\n", product);

    return 0;
}

Output

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

Explanation

  • `#include ` – Includes the standard input-output library for using `printf()` and `scanf()` functions.
  • `int num1, num2, product;` – Declares three integer variables.
  • `scanf()` – Takes user input for the two numbers.
  • `product = num1 * num2;` – Performs the multiplication operation.
  • `printf()` – Displays the result on the screen.