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
andrezito [222]
3 years ago
6

Write a console application that takes an integer input from the user and calculates the factorial of it. Note: factorial of Exa

mple Input: 5 Example Output: 1^ * 2^ * 3^ * 4^ * 5=120
Computers and Technology
1 answer:
Stells [14]3 years ago
4 0

Answer:

The program in Python is as follows:

n = int(input("Integer: "))

product = 1

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

   product*=i

   if(i!=n):

       print(str(i)+" *",end =" ")

   else:

       print(i,end =" ")

print(" = ",product)

Explanation:

This prompts the user for integer input

n = int(input("Integer: "))

This initializes the product to 1

product = 1

This iterates through n

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

This multiplies each digit from 1 to n

   product*=i

This generates the output string

<em>    if(i!=n):</em>

<em>        print(str(i)+" *",end =" ")</em>

<em>    else:</em>

<em>        print(i,end =" ")</em>

This prints the calculated product (i.e. factorial)

print(" = ",product)

You might be interested in
Write a function named "read_json" that takes a JSON formatted string as a parameter and return the data represented by the inpu
Lelu [443]

Answer:

Following are the program in the Python Programming Language.

import json #import package

#define function

def read_json(info):

 return json.loads(info)#load data in variable

#call and print the function

print(read_json('[{'A': 10}, {'Y': 16}, {'U': 28}]'))

<u>Output</u>:

[{'A': 10}, {'Y': 16}, {'U': 28}]

Explanation:

following are the description of the code

  • Define function "read_json()" and pass an argument "info" inside it.
  • Return the data inside from the "load()" function .
  • Call the function i.e "read_json" and passing the value to that function.
  • Print function print the data which is inside the "read_json" function.
3 0
3 years ago
Jeff wants to print quickly so he presses the Ctrl and the P. Jeff used a _____. macro invoice template shortcut
Allushta [10]
He used a keyboard shortcut.
3 0
4 years ago
What are the six external part of a computer
pashok25 [27]
I'm guessing you mean the six external parts as in input and output devices

Here are the six external parts:

>Keyboard

>Mouse

>Monitor

>Speakers

>Printer

>Microphone or USB...I think you can choose either one as they are components outside of the computer/external/ -I/O devices
5 0
3 years ago
Read 2 more answers
A significant and powerful aspect of the java language is the: (points : 1)
Elodia [21]
 <span>A significant and powerful aspect of the Java language is the: D. Object program. Java is inherently object-oriented, which means that Java programs are made up of programming elements called objects. [ [ Simply put, an object is a programming entity that represents either some real-world object or an abstract concept.</span>
7 0
4 years ago
What is the rarest gun on surviv io
IgorC [24]

Answer: It's the M249

Explanation: I wanna get brainliest XD

3 0
3 years ago
Read 2 more answers
Other questions:
  • Why does the hp computer not have Bluetooth?
    6·1 answer
  • What division monitors the sale and registration of vehicles and vessels within the state?
    15·1 answer
  • Under what driving conditions will 2019 Nissan LEAF’s available Rear Cross Traffic Alert (RCTA) warn the driver if a vehicle is
    11·1 answer
  • Who was the inventor of the iPhone?
    13·2 answers
  • Creating a Graphical User Interface in Java
    11·1 answer
  • Write a recursive function using pseudocode or C/C++.
    8·1 answer
  • When you click the Decrease Font Size button, Excel assigns the next highest font size in the Font Size gallery.
    8·1 answer
  • Referat noaptea la școala cu sfârșit de groază​
    10·1 answer
  • Who wrote the book of luke​
    7·1 answer
  • 9.2.8 last names codehs
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!