Computer Science, asked by richasinghvis, 2 months ago

Write an algorithm and draw a flowchart to enter a number and print the product of the digits of the given number..

Answer it plz.​

Answers

Answered by ankitsingh99162
2

Answer:

// C++ program to compute

// product of digits in the number.

#include<bits/stdc++.h>

using namespace std;

/* Function to get product of digits */

int getProduct(int n)

{

int product = 1;

while (n != 0)

{

product = product * (n % 10);

n = n / 10;

}

return product;

}

// Driver program

int main()

{

int n = 4513;

cout << (getProduct(n));

}

Output: 60

Explanation:

Algorithm:

start

initialize two variables a,b as int

input a,b, value from the user

start if a is equal to b the initialize sum as int

add a and b,store the value in sum variable

print sum

else initialize product as int

multiply a with b and store the result in product variable

print product

end if condition

end program

Hope its helpful for you.

Answered by ShradhaThakur77
0

Tell this to ma'am the moment she asks u 'bout this as informed 'bout your pleasing girl❤

Attachments:
Similar questions
Biology, 1 month ago