Math, asked by ishubhatt6, 1 year ago

Find the product of all integers from –1 to -5.​

Answers

Answered by manasa1010
15

Answer:

heya mate there's your answer

(-1)(-2)(-3)(-4)(-5)

(2)(12)(-5) (- × - = +)

(24)(-5)

(-120)

hope it helps you

Thank you

Answered by shivanshatl30
1

Answer:

Given a number, the task is to find the product of the digits of a number.

Examples:

Input: n = 4513

Output: 60

Input: n = 5249

Output: 360

Recommended: Please try your approach on {IDE} first, before moving on to the solution.

General Algorithm for product of digits in a given number:

Get the number

Declare a variable to store the product and set it to 1

Repeat the next two steps till the number is not 0

Get the rightmost digit of the number with help of remainder ‘%’ operator by dividing it with 10 and multiply it with product.

Divide the number by 10 with help of ‘/’ operator

Print or return the product

Below is the solution to get the product of the digits:

// cpp 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));

}

// This code is contributed by

// Surendra_Gangwar

Similar questions