Computer Science, asked by nirajkafle174, 14 days ago

WAP to find the product of three numbers

Answers

Answered by DüllStâr
34

\red{ \boxed{ \text{Required program:}}}

import java.util.*;

public class product

{

public static void main (String[]args)

{

Scanner sc = new Scanner (System.in);

int a;

int b;

int c;

int pro;

System.out.println("Enter value of first number :");

a = sc.nextInt();

System.out.println("Enter value of second number :");

b = sc.nextInt();

System.out.println("Enter value of third number :");

c = sc.nextInt();

int pro = a * b * c;

System.out.println("Product of three numbers are: "+pro);

}

}

 \\  \\

 \blue {\boxed{ \text{Input:}}}

Enter value of first number :

5

Enter value of second number :

7

Enter value of third number :

8

 \\  \\

 \green {\boxed{ \text{Output:}}}

Enter value of first number :

5

Enter value of second number :

7

Enter value of third number :

8

Product of three numbers are: 280

 \\  \\

 \pink{\boxed{ \text{Variable Description:}}}

1.

  • Variable name : a
  • Data type: int
  • Variable Description: to store value of first number .

2.

  • Variable name : b
  • Data type: int
  • Variable Description: to store value of second number .

3.

  • Variable name : c
  • Data type: int
  • Variable Description: to store value of third number .

4.

  • Variable name : pro
  • Data type: int
  • Variable Description: to store product of three numbers.
Answered by BrainlyProgrammer
8

Answer:

import java.util.*;

public class Numbers

{

public static void main (String[]args)

{

Scanner sc = new Scanner (System.in) ;

System.out.println("Enter three numbers :");

int a = sc.nextInt();

int b = sc.nextInt();

int c = sc.nextInt();

System.out.println("Product : "+(a*b*c) );

}

}

Logic:-

  • Accept 3 numbers using input
  • Simply multiply and print the product
Similar questions