Computer Science, asked by parvathypraveen63, 5 months ago

write a program to find the product of 'n' natural numbers using for loop​

Answers

Answered by Rajakhavin
1

Answer:

/**************************************************

Program to find the product of digits of a number

*

* Enter a number: 456

* 120

**************************************************/

#include<stdio.h> // include stdio.h library

int main(void)

{

int num, rem, prod = 1;

printf("Enter a number: ");

scanf("%d", &num);

while(num != 0)

{

rem = num % 10; // get the right-most digit

prod *= rem; // calculate product of digits

num /= 10; // remove the right-most digit

}

printf("%d", prod);

return 0; // return 0 to operating system

}

is the program for your question

MARK AS BRAINLIEST

Similar questions