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
Allushta [10]
3 years ago
13

Write a program that asks the user to input a positive integer and then calculates and displays the factorial of the number. The

program should call a function named getN
Computers and Technology
1 answer:
mestny [16]3 years ago
6 0

Answer:

<em>The program is written in python and it doesn't make use of any comment; </em>

<em>(See explanation section for line by line explanation)</em>

def getN(num):

     fact = 1

     for i in range(1, 1 + num):

           fact = fact * i

     print("Factorial: ",fact)

num = int(input("Number: "))

if num < 0:

     print("Invalid")

else:

     getN(num)

Explanation:

The function getNum is defined here

def getN(num):

Initialize the result of the factorial to 1

     fact = 1

Get an iteration from 1 to the user input number

     for i in range(1, 1 + num):

Multiply each number that makes the iteration

           fact = fact * i

Print result

     print("Factorial: ",fact)

Ths line prompts user to input number

num = int(input("Number: "))

This line checks if user input is less than 0; If yes, the program prints "Invalid"

if num < 0:

     print("Invalid")

If otherwise, the program calls the getN function

else:

     getN(num)

You might be interested in
A _____ is usually a smaller version of a data warehouse
Strike441 [17]
A ( micro ) is usually a smaller version of a data warehouse
4 0
2 years ago
Edhisive 3.5 code practice
Amanda [17]

Answer:

x = int(input("What grade are you in? "))

if (x == 9):

   print ("Freshman")

elif (x == 10):

   print("Sophomore")

elif (x == 11):

   print ("Junior")

elif (x == 12):

   print("Senior")

else:

   print ("Not in High School")

Explanation:

7 0
2 years ago
And what way do you mixed and market economy support the ideals of democracy​
PolarNik [594]
Mixed and market economies protect individuals' ability to make their own economic decisions.
5 0
3 years ago
What is the size of the array shoeSize? double [] shoeSize = {8.5, 7, 12.5, 9.5, 9, 11.5, 6}
r-ruslan [8.4K]

The size of the array shoeSize? double [] shoeSize = {8.5, 7, 12.5, 9.5, 9, 11.5, 6} is 6

Explanation:

  • Arrays are zero-based : the seven elements of a 7-element array are numbered from 0 to 6. Hence, the size of the array is 6.
  • An array is collection of items stored at memory locations. The main aim of an array is to store multiple items of same type together.
  • An array is a collection of one or more values of the same type. Each value is called an element of the array.
  • The location of an item in an array is known as array indexing.
  • The first array index is 0 or 1 and indexes continue through the natural numbers.
  • The upper bound of an array is generally language and possibly system specific.
  • An array type is a data type that represents a collection of elements each selected by one or more identifying keys that can be computed at run time during program execution.

6 0
2 years ago
Advertising andpublicity are used to:
WINSTONCH [101]

Answer:

d. All of the given options

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

<u>Advertising and Publicity</u> is used for many reasons.

Retail Companies use advertising and publicity to promote their products and in term increase sales of that product when it hits the shelves.

Meanwhile, other companies such as Law Firms use advertising and publicity create awareness for their law firm and communicate with customers over high profile case etc.

Therefore, the answer is all of the above.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
3 years ago
Other questions:
  • Because you do not know every possible future use for the data TerramEarth collects, you have decided to build a system that cap
    15·1 answer
  • _____ separation strategies (e.g., attacking and sabotaging others) are used by those for whom co-cultural segregation is an imp
    5·1 answer
  • Outcomes resulting from using incorect requirement specification during system development​
    11·1 answer
  • The Knowledge Consistency Checker (KCC) ensures the maximum number of hops between any two domain controllers does not exceed wh
    12·1 answer
  • A reference parameter differs from an output parameter in that a reference parameter ______________________ but an output parame
    5·1 answer
  • If we ignore the audio data in a video file, a video file is just a collection of many individual frames (i.e., images). What is
    6·1 answer
  • Second Largest, Second Smallest Write a program second.cpp that takes in a sequence of integers, and prints the second largest n
    15·1 answer
  • State three advantages of using a printer​
    15·1 answer
  • Why does Brainly not have a astronomy section. (I'd prefer brainly answer this)
    7·1 answer
  • Fwee Pwoints Fwor You
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!