Computer Science, asked by tapassen555, 19 days ago

Take a 3 digit number and find out the sum of 3 digits and product of 3 digits, Ex- 258
Sum= 2+5+8= 15
Product= 2*5*8= 80 in Java please tell me fast​

Answers

Answered by AaryaBalan
0

Answer:

var number = 258;

var str = String(number);

var add = 0;

var product = 1;

for(x of str){

add += Number(x);

product *= Number (x)

}

console.log(add, product)

Similar questions