Get Update on recent Technology & Programming

Wednesday, 15 November 2017

C Program to find the product of digits of any number

Posted by   on Pinterest

C Program to find the product of digits of any number






#include<stdio.h>

int main(void)

{

 int n,prod=1,rem;

 printf("Enter a number : ");

 scanf("%d",&n);

 while(n>0)

 {

  rem = n%10; /*taking last digit of n*/

  prod*=rem;

  n/=10; /*skipping last digit of n*/

 }

 printf("Product of digits = %d\n",prod);

 return 0;

}





No comments:
Write comments

Hey, we've just launched a new custom color Blogger template. You'll like it -
Join Our Newsletter