write a program to enter 4 digit no. and find the product of the digits
plz ans as soon as possible
use loop
Anonymous:
JAVA ??
Answers
Answered by
1
...*⃣❇❇❇❇❇ANSWER ❇❇❇❇*⃣
please refer to attachments above.. ⬆⬆⬆⬆⬆⌛
✨✨✨hope it helps ✨✨✨
please refer to attachments above.. ⬆⬆⬆⬆⬆⌛
✨✨✨hope it helps ✨✨✨
Attachments:
Answered by
3
CODE
import java.util.*;
class product_digits
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a number");
int n=sc.nextInt();
int p=1;
while(n>0)
{
int d=n%10;
p=p*d;
n=n/10;
}
System.out.println("The product of the digits = "+p);
}
}
OUTPUT :
Enter a number
56
The product of the digits = 30
Similar questions