Program to multiply two numbers

Description

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
In this program, program will take two number as input and give multiplication of
the two number as output. The first input stored in variable firstNumber and second
input stored in variable secondNumber. The variables firstNumber and secondNumber
are multiplied using the arithmetic operator * and the result is stored in the
variable result.
example : firstNumber = 8
secondNumber = 7
result = 56
In this program, program will take two number as input and give multiplication of the two number as output. The first input stored in variable firstNumber and second input stored in variable secondNumber. The variables firstNumber and secondNumber are multiplied using the arithmetic operator * and the result is stored in the variable result. example : firstNumber = 8 secondNumber = 7 result = 56
In this program, program will take two number as input and give multiplication of
the two number as output. The first input stored in variable firstNumber and second
input stored in variable secondNumber. The variables firstNumber and secondNumber
are multiplied using the arithmetic operator * and the result is stored in the
variable result.
example : firstNumber = 8
          secondNumber = 7
          result = 56

C/C++

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/* C Program to multiply two numbers */
//Save it as MultiplyTwoNumber.c
#include<stdio.h>
int main(){
float firstNumber, secondNumber, result;
printf("Enter the first number : ");
scanf("%f",&firstNumber);
printf("Enter the second number : ");
scanf("%f",&secondNumber);
result = firstNumber * secondNumber;
printf("The multiplication of %.3f and %.3f is %.3f",firstNumber,secondNumber,result);
return 0;
}
/* C Program to multiply two numbers */ //Save it as MultiplyTwoNumber.c #include<stdio.h> int main(){ float firstNumber, secondNumber, result; printf("Enter the first number : "); scanf("%f",&firstNumber); printf("Enter the second number : "); scanf("%f",&secondNumber); result = firstNumber * secondNumber; printf("The multiplication of %.3f and %.3f is %.3f",firstNumber,secondNumber,result); return 0; }
/* C Program to multiply two numbers */
//Save it as MultiplyTwoNumber.c

#include<stdio.h>
int main(){

    float firstNumber, secondNumber, result;

    printf("Enter the first number : ");
    scanf("%f",&firstNumber);

    printf("Enter the second number : ");
    scanf("%f",&secondNumber);

    result = firstNumber * secondNumber;

    printf("The multiplication of %.3f and %.3f is %.3f",firstNumber,secondNumber,result);

    return 0;
}
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Input:
Enter the first number :
3.5
Enter the second number :
1.2
Output:
The multiplication of 3.5 and 1.2 is 4.200
Input: Enter the first number : 3.5 Enter the second number : 1.2 Output: The multiplication of 3.5 and 1.2 is 4.200
Input:
Enter the first number : 
3.5
Enter the second number : 
1.2

Output:
The multiplication of 3.5 and 1.2 is 4.200
Multiplication Of two Numbers
Multiplication Of two Numbers

Java

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/* Java Program to multiply two numbers */
//Save it as MultiplyTwoNumber.java
import java.io.*;
import java.util.Scanner;
public class MultiplyTwoNumber {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
float firstNumber, secondNumber, result;
System.out.println("Enter the first number : ");
firstNumber = scanner.nextFloat();
System.out.println("Enter the second number : ");
secondNumber = scanner.nextFloat();
result = firstNumber * secondNumber;
System.out.println("The multiplication of "+firstNumber+" and "+secondNumber +" is "+result);
}
}
/* Java Program to multiply two numbers */ //Save it as MultiplyTwoNumber.java import java.io.*; import java.util.Scanner; public class MultiplyTwoNumber { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); float firstNumber, secondNumber, result; System.out.println("Enter the first number : "); firstNumber = scanner.nextFloat(); System.out.println("Enter the second number : "); secondNumber = scanner.nextFloat(); result = firstNumber * secondNumber; System.out.println("The multiplication of "+firstNumber+" and "+secondNumber +" is "+result); } }
/* Java Program to multiply two numbers */
//Save it as MultiplyTwoNumber.java

import java.io.*;
import java.util.Scanner;

public class MultiplyTwoNumber {

    public static void main(String[] args) {

            Scanner scanner = new Scanner(System.in);
        
            float firstNumber, secondNumber, result;

        System.out.println("Enter the first number : ");
        firstNumber = scanner.nextFloat();

        System.out.println("Enter the second number : ");
        secondNumber = scanner.nextFloat();

        result = firstNumber * secondNumber;

        System.out.println("The multiplication of "+firstNumber+" and "+secondNumber +" is "+result);
    }
}
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Input:
Enter the first number :
3.5
Enter the second number :
1.2
Output:
The multiplication of 3.5 and 1.2 is 4.2000003
Input: Enter the first number : 3.5 Enter the second number : 1.2 Output: The multiplication of 3.5 and 1.2 is 4.2000003
Input:
Enter the first number : 
3.5
Enter the second number : 
1.2

Output:
The multiplication of 3.5 and 1.2 is 4.2000003

Related Programs

1) Add Two Numbers
2) Program to subtract two numbers
3) Program to divide two numbers
4) Program to find modulus of two numbers
5) Program to find Quotient and Remainder
6) Program to calculate power of a number
7) Program to calculate Permutation And Combination
8) Program to find simple interest
9) Program to calculate Gross Salary
10) Program to calculate percentage mark of student
Share Me

Leave a Reply