Calculations

C program to multiply two numbers

C program to multiply two numbers

In this tutorial, we will discuss the C program to multiply two numbers.

In this topic, we will learn how to multiply two integer number in the C programming language

Multiply two integer value

Program 1

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int f_no,s_no,product;
    printf("Enter the first number: ");
    scanf("%d",&f_no);//get input from user for first number
    
    printf("Enter the second number: ");
    scanf("%d",&s_no); //get input from user for second number
    
    product=f_no*s_no;  //calculate product
    
    printf("The multiplication of two numbers are: %d\n",product);
    //display of product on the screen
    getch();
    return 0;
}

When the above code is compiled and executed, it produces the following results

Enter the first number: 12
Enter the second number: 32
The multiplication of two numbers are : 384

 

This is a simple C program to find the product of two integer numbers.

In the above program, we declared two different integer values such as  12 and 32 stored in variables f_no, s_no respectively.
Then, we can find the product of given numbers using the * operator

finally, we could display the result on the screen using printf() function in C language.

Multiply two floating point value

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("find Product of floating point value\n");
   float f_No,s_No,product;
    printf("Enter the first number: ");
    //store the floating point value in variable f_No
    scanf("%f",&f_No);
    printf("Enter second number: ");
    scanf("%f",&s_No);
    //store the floating point value in variable s_No

product=f_No * s_No;
//multiply two numbers and store the result in variable product

printf("the Product is : = %.3f",product);
//display result up to 3 decimal places
getch();
    return 0;
}

When the above code is compiled and executed, it produces the following results

find Product of floating point value
Enter the first number: 4.3
Enter second number: 3.21
the product is: 13.803

This is a simple C program to find the product of two floating point numbers.

In the above program, we declared two different floating point values such as  4.3 and 3,21 stored in variables f_No, s_No respectively.
Then, we can find the product of given numbers using the * operator in c

finally, we could display the result on the screen using printf() function in C language.

Java program to multiply two numbers
CPP program to multiply two numbers
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

1 month ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

1 month ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

2 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

5 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

10 months ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

10 months ago