0) { rem = n % 10; prod *= rem; n /= 10; } printf("product of digits = %d\n", […]" /> How to use find the product of digits of any number in c language – Web Developement, WordPress Development, Create Logo, Illustration

C Language

May 27, 2023

How to use find the product of digits of any number in c language

program to use find the product of digits of any number in c language


#include <stdio.h>
int main()
{
    int n, prod = 1, rem;
    printf("enter a number : ");
    scanf("%d", &n);
    while (n > 0)
    {
        rem = n % 10;
        prod *= rem;
        n /= 10;
    }
    printf("product of digits = %d\n", prod);
    return 0;
}

output


enter a number : 166
product of digits = 36

by : Ajaj Khan

Quick Summary:

program to use find the product of digits of any number in c language copy #include &ltstdio.h> int main() { int n, prod = 1, rem; printf(“enter a number : “); scanf(“%d”, &n); while (n > 0) { rem = n % 10; prod *= rem; n /= 10; } printf(“product of digits = %d\n”, […]