Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

sum of product of digits of a given number

// Java program to compute
// product of digits in the number.
 
import java.io.*;
 
class GFG {
 
    /* Function to get product of digits */
    static int getProduct(int n)
    {
        int product = 1;
 
        while (n != 0) {
            product = product * (n % 10);
            n = n / 10;
        }
 
        return product;
    }
 
    // Driver program
    public static void main(String[] args)
    {
        int n = 4513;
 
        System.out.println(getProduct(n));
    }
}
Comment

sum of product of digits of a given number

<script>
 
// JavaScript program to compute
// product of digits in the number.
 
// Function to get product of digits
function getProduct(n)
{
    let product = 1;
 
    while (n != 0)
    {
        product = product * (n % 10);
        n = Math.floor(n / 10);
    }
    return product;
}
 
// Driver code
let n = 4513;
 
document.write(getProduct(n));
 
// This code is contributed by Manoj.
 
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: board in javascript 
Javascript :: NodeJS Database initialisation 
Javascript :: how to get creator of inetarceton discordjs 
Javascript :: Assigning A Property The Return Value Of A Function In Class 
Javascript :: registration page validation in react 
Javascript :: Use Dynamic Scales 
Javascript :: Getting The Search Params With A For Of Loop 
Javascript :: Hardhat config file multiple network 
Javascript :: add text to each element in an array javascript 
Javascript :: isPowerOfTow 
Javascript :: ONDC node 
Javascript :: useState intro 
Javascript :: winston transport file another directory 
Javascript :: The most obvious example is handling the click event, 
Javascript :: Update react final form field 
Javascript :: Backbone Router Notes 
Javascript :: document.getelementbyid add number 
Javascript :: run javascript after rendering 
Javascript :: convert text to number 
Javascript :: clear console javascript 
Javascript :: mounting in react 
Javascript :: js return 
Javascript :: jquery search string for substring 
Javascript :: hello world in react 
Javascript :: adonisjs char 
Javascript :: open in new tab js html does not work on iphone 
Javascript :: JavaScript for loop Display Numbers from 1 to 5 
Javascript :: javascript Passing undefined Value 
Javascript :: electron InitializeSandbox() called with multiple threads in process gpu-process. 
Javascript :: simple counter with react hook 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =