Program to print product of digit using while loop in C-language

#include<stdio.h>
int main()
{
    int n,a,p=1;
    printf("Enter the number\n");
    scanf("%d",&n);
    while(n!=0)
    {
        a=n%10;
        n=n/10; 
    p=p*a;
    }
    printf("Product of digit=%d",p);
}

OUTPUT
Enter the number
1234
Product of digit=24

Comments

Popular posts

Creative pattern of butterfly in C-language

Program to cheque enter number is even or odd in c-language

Creative Pattern of Rhino in C-language

Variable & Datatype for C-programming

Division of two numbers in C-language

Program to print the cube of a number in c-language