1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vlad [161]
4 years ago
8

Write a recursive function that returns the product of the digits of its integer input parameter, n. You omay assume that n is n

on-negative. For example, productDigits(243) should return 24, since 2 x 4 x 3
Computers and Technology
1 answer:
IceJOKER [234]4 years ago
7 0

Answer:

The solution code is written in Python:

  1. def productDigits(n):
  2.    if(n // 10 == 0  ):
  3.        return n
  4.    else:
  5.        return (n%10) * productDigits(n//10)

Explanation:

Firstly we define a function named it as productDigits which takes one input parameter, n. (Line 1)

Next, we create if-else statements by setting the condition if the input n divided by 10 is equal to 0 (this means the n is only 1 digit), the program shall return the n (Line 3-4).

Otherwise, the program will return the remainder of the n divided by 10 multiplied with the output of the recursive function calling with input n//10 (Line 5-6).

Please note the usage of // is to discard the decimal point of the division result.

You might be interested in
Is ubisoft still making assassins creeds on xbox 360
BabaBlast [244]
I don’t think so. Not sure though
8 0
4 years ago
Read 2 more answers
What critical-thinking tool is being used when asking the question, Is this information specific enough?
Murljashka [212]
Precision, specificity is related to the accuracy of the information with respect to the subject at hand. Precision is the only answer that makes sense.
6 0
3 years ago
What are the four conditions to help determine whether a website is a good source for information?
Ratling [72]

Answer:

1. Credible Websites are Registered with Legitimate Institutions 2. Watch out for Dummy Content for Website Credibility Check 3. Watch out for Scam Advertisements to Verify Website Credibility 4. Professional Designs Mean Everything

Explanation:

3 0
2 years ago
When a private network uses a single public ip address, and each outgoing tcp packet uses a different port to allow for proper t
m_a_m_a [10]
The networking technology in use is NAT.
8 0
3 years ago
What were the goals of the “paperless society” ideal? to more easily access and save information and to reduce waste to create m
sveta [45]

The answer is : to more easily access and save information and to reduce waste. It is more convenient to receive and store our information in a digital format. when we reduce paper waste by using technology more.  

4 0
3 years ago
Read 2 more answers
Other questions:
  • Of the different IRT roles, the _______________ is head of the team and issues the ultimate call regarding how to respond to an
    15·1 answer
  • You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will
    12·1 answer
  • Ead the following scenario and then answer the question.
    10·1 answer
  • PLEASE  HELPPPP!!!!!
    14·1 answer
  • Search engines enable you to
    12·1 answer
  • Always follow the routine "clean up while in use and clean up before keeping it".
    6·1 answer
  • Using range(1,101), make two list, one containing all even numbers and other containing all odd numbers. How can I do this on Py
    15·1 answer
  • Identify the names of the following:<br><br>Please help me.​
    12·1 answer
  • Design an Application called Student Course Management create interface called Student Course add an abstract method called ad C
    10·1 answer
  • Missing appropriate security hardening across any part of the application stack or improperly configured permissions is an examp
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!