write a program for the multiplication of three different variables
Answers
Answer:
CLS
INPUT"1ST NUMBER=";A
INPUT"2ND NUMBER=";B
INPUT"3RD NUMBER=";C
MULTIPLICATION=A*B*C
PRINT"YOUR ANSWER=";MULTIPLICATION
END
Explanation:
HOPE IT WILL HELP YOU MARK AS BRANLIEST IF IT WAS.
The following program has been written using Python.
a = float (input ("Enter the first number: "))
b = float(input("Enter the second number: "))
c = float(input("Enter the third number: "))
product = a * b * c
print("The multiplication of three given numbers is: ", product)
The following program has been written using Java.
import java.util.Scanner;
public class Main
{
public static void main (String[]args)
{
Scanner sc = new Scanner (System.in);
double a, b, c, product;
System.out.print("Enter the first number: ");
a = sc.nextDouble();
System.out.print("Enter the second number: ");
b = sc.nextDouble();
System.out.print("Enter the third number: ");
c = sc.nextDouble();
product = a * b * c;
System.out.println("The multiplication of three given numbers is: " + product);
}
}
The following program has been written using C.
#include <stdio.h>
int main()
{
double a, b, c, product;
printf("Enter the first number: ");
scanf("%lf", &a);
printf("Enter the second number: ");
scanf("%lf", &b);
printf("Enter the third number: ");
scanf("%lf", &c);
product = a * b * c;
printf("The multiplication of three given numbers is: %.2lf", product);
return 0;
}
The following program has been written using C++.
#include <iostream>
using namespace std;
int main() {
double a, b, c, product;
cout << "Enter the first number: ";
cin >> a;
cout << "Enter the second number: ";
cin >> b;
cout << "Enter the third number: ";
cin >> c;
product = a * b * c;
cout << "The multiplication of three given numbers is: " << product;
return 0;
}
The following program has been written using QBasic.
CLS
INPUT "Enter the first number:"; a
INPUT "Enter the second number:"; b
INPUT "Enter the third number:"; c
Product = a * b* c
PRINT "The multiplication of three given numbers is:"; Product
END
The Logic
Here, we ask the user to enter three numbers and store the values in three different variables, a, b and c respectively.
We multiply these three variables using the * operator and store them in the variable product using:
>>> product = a * b * c;
Then we assign the result on the screen.
I have added a .txt file from where you can get all the codes.