input program in java : write a program to input 3 numbers and find their product?
In C++ program
tell me the correct answer and I mark you as brainliest
Answers
CⓞDE In JAVA
import java.util.*;
public class BeBrainly
{
public static void main(String[] args)
{
int a, b, c, result;
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the 1st no:");
a = scanner.nextInt();
System.out.println("Enter the 2nd no:");
b = scanner.nextInt();
System.out.println("Enter the 3rd no:");
c = scanner.nextInt();
result = a*b*c;
System.out.println("The product of a, b and c is: "+result);
}
}
Example Output:
Enter the 1st no:
10
Enter the 2nd no:
20
Enter the 3rd no:
30
The product of a, b and c is: 6000
CⓞDE In C++
#include <iostream>
using namespace std;
int main()
{
int x, y, z, product;
cout << "Enter 1st no: ";
cin >> x;
cout << "Enter 2nd no: ";
cin >> y;
cout << "Enter 3rd no: ";
cin >> z;
product = x*y*z;
cout << "Product of a, b and c is: " << product;
return 0;
}
EXAMPLE OUTPUT
Enter 1st no: 10
Enter 2nd no: 20
Enter 3rd no: 30
Product of a, b and c is: 6000