WAP to input 6-digit number and find the sum and product of its digit
Answers
Answered by
1
Answer:
import java.util.*;
class ab
{
public static void main ()
{
int s= 0,d,p=1;
Scanner sc = new Scanner (System.in);
int n= sc. nextInt ();
while (n>0)
{
d= n%10;
s= s+d;
p=p*d;
n=n/10;
System.out.println("Sum:"+ s);
System.out.println("Product:"+p);
}
}
}
Similar questions