Write a program that lets a user enter N and that outputs N! (N factorial, meaning N*(N-1)*(N-2)*..\.\*2*1). Hint:Use a loop variable i that counts from total-1 down to 1. Compare your output with some of these answers: 1:1, 2:2, 3:6, 4:24, 5:120, 8:40320.

Answers

Answer 1

Answer:

The program is as follows:

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

fact = 1

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

   fact*=i

print(fact)

Explanation:

This gets integer input from the user

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

This initializes factorial to 1

fact = 1

The following iteration calculates the factorial of the integer input

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

   fact*=i

This prints the calculated factorial

print(fact)


Related Questions

Select the pseudo-code that corresponds to the following assembly code. Assume that the variables a, b, c, and d are initialized elsewhere in the program. You may want to review the usage of EAX, AH, and AL (IA32 registers). Also recall that the inequality a > b is equivalent to b < a. i.e. If A is greater than B, that's equivalent to saying that B is less than A.
.data
; General purpose variables
a DWORD ?
b DWORD ?
c BYTE ?
d BYTE ?
upperLevel DWORD 18
lowerLevel DWORD 3
; Strings
yes BYTE "Yes",0
no BYTE "No",0
maybe BYTE "Maybe",0
code
main PROC
mov eax, 1
cmp AH, c
jg option1
jmp option3
option1:
mov edx, OFFSET yes
call WriteString
jmp endOfProgram
option2:
mov edx, OFFSET no
call WriteString
jmp endOfProgram
option3:
mov edx, OFFSET maybe
call WriteString
endOfProgram:
exit
main ENDP
END main
a) if (c > 0)
print (yes);
else
print (maybe);
b) if (c < 0)
print (yes);
else
print (maybe);
c) if (c < 1)
print (yes);
else
print (maybe);
d) if (c > 1)
print (yes);
else
print (maybe);

Answers

Answer:

ae

Explanation:

The pseudo-code that corresponds to the given assembly code is:

b) if (c < 0)

print (yes);

else

print (maybe);

What is the pseudo-code

In assembly code, the command cmp AH, c checks if the high byte of the EAX register (AH) has the same value as the variable c. Then, if the value in AH is more than the value in c, the instruction jg option1 will move to option1.

Therefore, In the pseudo-code, one can check if c is smaller than 0. If it happens, we say "yes". If not, we say "maybe"

Read more about   pseudo-code here:

https://brainly.com/question/24953880

#SPJ2

when was first generation of computer invented? ​

Answers

Introduction: 1946-1959 is the period of first generation computer. J.P.Eckert and J.W. Mauchy invented the first successful electronic computer called ENIAC, ENIAC stands for “Electronic Numeric Integrated And Calculator”.

(1)similarities between backspace key and delete key. (2) different between backspace key and delete key. (3) explain the term ergonomics. (4) explain the following. a click b right click c double click d triple click e drag and drop​

Answers

Answer:

1.similarity:

they are both editing keys

3.ergonomics are designed keying devices that alleviates wrist strain experienced when using ordinary keyboard for long hours

4.

.a click is pressing and releasing the left mouse button onceright click is pressing the right mouse button once to display a short cut menu with commands from which a user can make a selectiondouble click is pressing the left button twice in rapid successiondrag and drop is where by the user drags an icon or item from one location on the screen to another.

If your organization hires a new employee, what would you do to create a user account in the Linux system and add the account to a group? What commands would you use? What configuration files would you check and modify?

Answers

Following are the responses to this question:

The user account is "olivia".In the Linux system to see the account go to the "/home directory".For the configuration file we use ".bash_logout , .bash_profile, and .bashrc" files.

Creating users:

We will use the useradd command to achieve this. Using that same command, you can create users who would log in or customers who would log in (in the case of creating a user for a software installation).

In its basic form, the command is as follows:

[Options] useradd username

Take this user olivia, for instance. Assuming that you had been to issue the command prompt:

olivia has become a user.

Users are added to the system without the need for a home directory and are unable to log on. It if we were using this rather than running the command without arguments?

sudo using useradd -m olivia

Using the command above, a new user would be created, including a home directory that corresponded to the username. That means that you might now see the name "olivia" in the directory "/home".

But what about the lockout concern that was raised earlier? Both these methods are possible. After creating the user, you can enter the following command:

Password for olivia is: sudo passwd olivia

You'll be requested to enter & verify your new password once you've completed the process. This unlocks the user profile, allowing them to log in.

This command might look like if you wanted to accomplish it in one go:

sudo useradd -m olivia -p PASSWORD

You should be using Passcodes as the login for the user olivia.

As soon as the user logs in, he or she can update their account password by using the password command to input their current password, and afterward entering/verifying their new one.

To create a user that has no personal account and cannot log in, execute the following instructions:

sudo use useradd as  the-M USERNAME ​sudo use usermod as the -L USERNAME

The user to be added is identified by USERNAME.

It establishes a user with really no root folder and prevents them from signing in with a second operation.

To add an existing user to a group on Linux, follow the instructions:

As root, log in to your accountUse the useradd instruction to add a new user (for example, useradd roman)If you'd like to log on as a new customer, type su plus that user's name.Entering the word "exit" will logout you from your account.

Another way to add a user to a group under Linux would be to use the following syntax:

Alternatively, you can use the usermod command.The name of the club should be substituted for example group in this sentence.Example username should be replaced with the name of the user you'd like added.

The following operations are performed when a new login is added to the system.

The user's home directory (/home/username by default) is now created.To set configuration files for the user's session, the following secret files are copied into another user's home directory.

.bash_logout

.bash_profile

.bashrc

/var/spool/mail/username includes the user's mail spool.The new user account is arranged in groups with the same name.

Learn more:

Linux system: brainly.com/question/13843535

if you want to present slides to fellow students or co workers, which productivity software should you use

Answers

Answer:

Power point is a good software to use for slides

Convert the following denary numbers into
binary (using both methods):
a 41
b 67
C 86
d 100
e 111
f 127
g 144
h 189
i 200
j 255

Answers

Answer:

101001

1000011

1010110

1100100

1101111

1111111

10010000

10111101

11001000

11111111

Given a constant named size with a value of 5, which statement can you use to define and initialize an array of doubles named gallons with 5 elements? a. double gallons[size] = { 12.75, 14.87, 9.74, 6.99, 15.48 }; b. double gallons[size] { 12.75, 14.87, 9.74, 6.99, 15.48 }; c. double gallons[] { 12.75, 14.87, 9.74, 6.99, 15.48 }; d. all of the above e. a and b only

Answers

Answer:

all of the above

How do i connect WiFi on windows xp without icon?

Answers

Right click anywhere on your taskbar, and then click Properties. Step 2: Find and click the Notification Area tab on the top bar, and then find the section labeled with System icons, check the checkbox for Network. Last, click OK to finish it.

Answer:

Right click anywhere on your taskbar, and then click Properties. Step 2: Find and click the Notification Area tab on the top bar, and then find the section labeled with System icons, check the checkbox for Network. Last, click OK to finish it.

What is meant by usability and what characteristics of an interface are used to assess a system’s usability?

Answers

Answer:

The answer is below

Explanation:

Usability is a term that describes the assessment of the performance of a system in assisting the task of the user, or how effective a certain product system or design supports the task of a user in accomplishing a set out objective as desired.

The characteristics of an interface that are used to assess a system’s usability are:

1. Effectiveness

2. Efficiency

3. Error Tolerance

4. Engagement

5. Ease of Learning and Navigation

Write a program that takes a date as input and outputs the date's season. The input is an integer to represent the month and an integer to represent the day. Ex: If the input is: 4 11 the output is: spring In addition, check if both integers are valid (an actual month and day). Ex: If the input is: 14 65 the output is: invalid The dates for each season are: spring: March 20 - June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 - March 19

Answers

Answer:

Explanation:

The following program is written in Java. It is a function that takes in the two parameters, combines them as a String, turns the combined String back into an integer, and uses a series of IF statements to check the parameters and determine which season it belongs to. Then it prints the season to the screen. The code has been tested with the example provided in the question and the output can be seen in the attached image below.

class Brainly {

   public static void main(String[] args) {

       getSeason(4, 65);

       getSeason(4, 11);

   }

   public static void getSeason(int month, int day) {

       String combined = String.valueOf(month) + String.valueOf(day);

       int combinedInt = Integer.parseInt(combined);

       if ((month > 0 && month < 12) && (day > 0 && day < 31)) {

           if ((combinedInt >= 320) && (combinedInt <= 620)) {

               System.out.println("The Season is Spring");

           } else if ((combinedInt >= 621) && (combinedInt <= 921)) {

               System.out.println("The Season is Summer");

           } else if ((combinedInt >= 922) && (combinedInt <= 1220)) {

               System.out.println("The season is Autumn");

           } else {

               System.out.println("The Season is Winter");

           }

       } else {

           System.out.println("Invalid date");

       }

   }

}

Irene llegó tarde al colegio_______________
ayúdenme


^_^^_^^_^^_^^_^^_^^_^^_^^_^​

Answers

Answer:

Explanation:

Absconding

Write a c program that asks the user
to enter distance in KM and Petrol Price in Rs.
Program should compute estimated budget for
the travel distance (Assume your car covers 100
KM in 8 Liters of fuel). Program should run in a
loop and ask the user “Do you want to
continue?”. If user enters ‘y’ or ‘Y’ program
should repeat otherwise terminate.

Answers

Answer:

#include <stdio.h>

int main()  

{

int x;

float y;

printf("Input total distance in km: ");

scanf("%d",&x);

printf("Input total fuel spent in liters: ");

scanf("%f", &y);

printf("Average consumption (km/lt) %.3f ",x/y);

printf("\n");

return 0;

}

When you expect a reader of your message to be uninterested, unwilling, displeased, or hostile, you should Group of answer choices begin with the main idea. put the bad news first. send the message via e-mail, text message, or IM. explain all background information first.

Answers

Answer:

explain all background information first.

Explanation:

Now if you are to deliver a message and you have suspicions that the person who is to read it might be uninterested, unwilling, hostile or displeased, you should put the main idea later in the message. That is, it should come after you have provided details given explanations or evidence.

It is not right to start with bad news. As a matter of fact bad news should not be shared through mails, IM or texts.

If you were driving the blue Prius in the situation pictured above, explain why the red Mustang should be given right-of-way at this intersection.

Answers

Answer:

The red Mustang should be given the right-of-way at this intersection because:

The red Mustang arrived first before the blue Prius and is closer to the stop sign before the arrival of the blue Prius.  This implies that the red Mustang must have waited for its turn, unlike the blue Prius that just arrived at the intersection.

Explanation:

Traffic laws, regulations, and IPDE defensive driving strategy require that drivers always give way to the vehicle that arrived before them at an intersection.   Assuming that multiple vehicles reach the intersection simultaneously, then the vehicle must be given the right-of-way.  Alternatively, the traffic lights at the intersection should be obeyed and be allowed to regulate the movement of vehicles.  IPDE defensive driving strategy requires drivers to be watchful of their driving spaces to determine the appropriate time to move.

__________ makes the hardware usable, while __________ commands it to perform specific tasks. a.) The operating system, RAM b.) The CPU, RAM c.) The application software, the hard disk d.) The operating system, the application software

Answers

Answer:

a then c

Explanation:

Without an operating system you just have a pile of metal, and the program contains code, which is just a series of commands

Answer:

d.) The operating system, the application software

Hello everybody,
For the quiz questions, I tried using the circular method, but got a numeric, period or comma error?
So I tried using the solver to find the same solution I got, but when I entered it in the answer box, he always said incorrectly.
Any help would be highly appreciated and write the results here, why do I have to read the solution quiz because I was wrong? thank you.


The bisection method is being used to calculate the zero of the following function between x = 0 and x = 1.
What is the midpoint for the 3rd iteration? (The midpoint for the 1st iteration is 0.5.) Provide your answer rounded to the thousandths place.

Answers

Answer:

i don't know the answer please tell me

Write a program which will create an array of size 10. Fill the array with random numbers from 0 - 100. (use a loop and random number generator rand) Once you are done with this, you will then write a loop which will go through each element of the array, display the contents of that element and tell if that element is an even number or odd number. Go through all the elements again and this time tell me how many are even and odd.

Answers

Answer:

Explanation:

The following code is written in Java. It randomly generates 10 integers and adds them to an integer array called myArr. Then it loops through the array calculating if each number is even or odd. If it is even it adds 1 to the evenCount variable and prints out the number saying that it is even. Otherwise it adds 1 to the oddCount variable and prints the number saying that it is odd. The program was tested and the output can be seen in the attached image below.

import java.util.*;

class Brainly {

   // Main Method

   public static void main(String[] args) {

       Random rand = new Random();

       int[] myArr = new int[10];

       for (int i = 0; i<10; i++) {

           int n = rand.nextInt(101);

           myArr[i] = n;

       }

       int evenCount = 0;

       int oddCount = 0;

       for (int x : myArr) {

           if ((x % 2) == 0) {

               evenCount += 1;

               System.out.println(x + " is Even");

           } else {

               oddCount +=1;

               System.out.println(x + " is Odd");

           }

       }

       System.out.println("The Array has a total: ");

       System.out.println(evenCount + " Even Numbers");

       System.out.println(oddCount + " Odd Numbers");

   }

}

(True/False). In an "ID" column with the data type INTEGER PRIMARY KEY, each value entered for the ID must be unique.

Answers

Answer:

The answer is "True".

Explanation:

The key to a relational database that is unique for each data record is a primary key, also called a primary keyword.This unique identifier, including a driver's license name, telephone number, or vehicle identification number. This is an identifier (VIN).There must always be the only primary key in such a relational database.This is a specific relational database field (or column combination) that identifies each table entry in a unique way.It utilized it to swiftly analyze the data within the table as a unique identifier.

Use the tables below to show the difference between the results of a natural join, an equijoin (with PROF_CODE = 2) and a full outer join. Provide the resulting table of each join

Answers

Answer:

Code:

CREATE TABLE student (

stu_code INTEGER PRIMARY KEY,

prof_code INTEGER

);

INSERT INTO student VALUES (100278,null);

INSERT INTO student VALUES (128569,2);

INSERT INTO student VALUES (512272,4);

INSERT INTO student VALUES (531235,2);

INSERT INTO student VALUES (531268,null);

INSERT INTO student VALUES (553427,1);

CREATE TABLE professor (

prof_code INTEGER PRIMARY KEY,

dept_code INTEGER

);

INSERT INTO professor VALUES (1,2);

INSERT INTO professor VALUES (2,6);

INSERT INTO professor VALUES (3,6);

INSERT INTO professor VALUES (4,4);

The SQL NATURAL JOIN is a type of EQUI JOIN and is structured in such a way that, columns with the same name of associated tables will appear once only. In our Example, Prof_code will appear only once and it will be matched in both the table;  

SELECT * FROM Student natural join Professor on student.prof_code=Professor.prof_code ;  

Stud_code   Prof_code  Dept_code

128569        2           6

512272        4           4

531235        2           6

553427        1           2

EQUI JOIN performs a JOIN against equality or matching column(s) values of the associated tables and an equal sign (=) is used as a comparison operator in the where clause to refer to equality. In our example, it will only show the result with prof_code=2 from the natural join result.

SELECT * FROM Student join Professor on student.prof_code=Professor.prof_code where student.prof_code=2;

Stud_code Prof_code Prof_code Dept_code

128569     2         2         6

531235     2         2         6

In SQL the FULL OUTER JOIN combines the results of both left and right outer joins and returns all (matched or unmatched) rows from the tables on both sides of the join clause.

SELECT * FROM professor full outer join student on professor.prof_code=student.prof_code ;

Stud_code Prof_code Prof_code Dept_code

100278                

128569    2          2         6

512272    4          4         4

531235    2          2         6

531268    

                    3         6

553427    1          1         2

If x=3.123, then int(x) will give ?

Answers

Answer:

3

Explanation:

int(x)=3

int(x) rounds to the smallest whole number

For example,

if you say int(3.99) it is also 3

Write an algorithm to find the sum of the following series:
a) 1+x+x^2+x^3+...+x^20
b) 1-x+x^2-x^3+...+x^20
c) 1+x/2+(x²)/3+(x^3)/4+...+(x^20)/21

Answers

Answer:

The algorithm is as follows:

Input x

sum_a = 0

sum_b = 0

sum_c = 0

for i = 0 to 20

   sum_a = sum_a + x^i

   sum_b = sum_b + (-x)^i

   sum_c = sum_c + x^i/(i+1)

print sum_a, sum_b, sum_c

Explanation:

Required

An algorithm to solve (a), (b) and (c)

For Series (a):

This series is a geometric progression and the common ratio is x

i.e.

[tex]r = x/1 = x^2/x = ...... = x^{n+1}/x^n =x[/tex]

So, the sum of the series is:

Sum = Previous Sums + x^i --- where i is between 0 and 20 (inclusive)

For Series (b):

This series is a geometric progression and the common ratio is -x

i.e.

[tex]r = -x/1 = -x^2/x = ...... = -(x^{n+1}/x^n) = -x[/tex]

So, the sum of the series is:

Sum = Previous Sums + (-x^i) --- where i is between 0 and 20 (inclusive)

For Series (c):

This series is a neither arithmetic nor geometric progression.

It obeys the following rule:

[tex]\frac{x^i}{1+i}[/tex]  --- where i is between 0 and 20 (inclusive)

So, the sum of the series is:

Sum = Previous Sums + [tex]\frac{x^i}{1+i}[/tex]

how can I order the prices negatively affect other producers of goods and services​

Answers

Scarcity of availability causes producers to either charge
higher prices or to produce more goods and services (like energy
production, cars, paper, etc.)

During the testing phase of an ERP system, the system implementation assurers should review: Group of answer choices Program change requests Vendor contracts Error reports Configuration design specifications

Answers

Answer:

Error reports

Explanation:

ERP is a multimodal software system that integrates all business processes and the function's of the entire organizations into  single software system using a one database.

_________ are standard devices, such as switches and routers, that have small onboard computers to monitor traffic flows through the device as well as the status of the device and other devices connected to it

Answers

Answer:

Managed devices

Explanation:

hope it helps u

Microsoft created Adobe Photoshop? TRUE FALSE​

Answers

Answer:

false the creator of adobe photoshop was microsoft adobe photoshop is a popular photo editing software which was developed by a company named as adobe inc.

Answer:

Photoshop is created by Adobe, and Adobe is an independent company started by Jhon Warnockand.

Create a function, return type: char parameters: int *, int * Inside the function, ask for two integers. Set the user responses to the int * parameters. Prompt the user for a character. Get their response as a single character and return that from the function. In main Define three variables and call your function. Print values of your variables

Answers

Answer and Explanation:

In C programming language:

char fun(int*a, int*b){

printf("enter two integers: ");

scanf("%d%d",a,b);

int e;

printf("please enter a character: ");

e=getchar();

return e;

}

int main(int argc, char *argv[]) {

int d;

int f;

int g;

fun();

printf("%d%d%d", d, f, g);

}

We have declared a function fun type char above and called it in main. Note how he use the getchar function in c which reads the next available character(after the user inputs with printf()) and returns it as an integer. We then return the variable e holding the integer value as char fun() return value.

1. Write an application that throws and catches an ArithmeticException when you attempt to take the square root of a negative value. Prompt the user for an input value and try the Math.sqrt() method on it. The application either displays the square root or catches the thrown Exception and displays an appropriate message. Save the file as SqrtException.java.
2. Create a ProductException class whose constructor receives a String that
consists of a product number and price. Save the file as ProductException.java.
Create a Product class with two fields, productNum and price. The Product
constructor requires values for both fields. Upon construction, throw a
ProductException if the product number does not consist of three digits, if the
price is less than $0.01, or if the price is over $1,000. Save the class as Product.java.
Write an application that establishes at least four Product objects with valid and invalid values. Display an appropriate message when a Product object is created
successfully and when one is not. Save the file as ThrowProductException.java.

Answers

Answer:

Hence the answer is given as follows,

Chất xơ có nhiều trong thực phẩm nào?

Answers

Answer:

Quả lê Quả lê là một loại trái cây phổ biến vừa ngon vừa bổ dưỡng. ...

Quả dâu tây. Dâu tây là loại quả cực kỳ ngon. ...

Quả bơ Quả bơ khác hơn so với hầu hết các loại trái cây. ...

Quả táo. ...

Quả mâm xôi. ...

Quả chuối. ...

Cà rốt. ...

Củ cải đường.

Write a game that performs the roll of two dice randomly. The game should first ask for a target sum. Everytime the player enters r, the program should repeatedly print the side of the dice on a separate line. The game should stop prompting if one of these two events occur: -The sum of the two sides is equal to the target sum. -The player enters q.

Answers

Answer:

Explanation:

The following program was written in Java. It asks the user to first enter the target sum. Then it creates a while loop that continues asking the user to either roll dice or quit. If they decide to roll, it rolls the dice and prints out both values. If the target sum was hit, it prints that out and exits the program otherwise it loops again. The code has been tested and can be seen in the attached image below.

import java.util.Random;

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Random rand = new Random();

       Scanner in = new Scanner(System.in);

       System.out.print("Enter Target Sum: ");

       int targetSum = in.nextInt();

       while (true) {

           System.out.println("r: Roll Again");

           System.out.println("q: Quit");

           String choice = in.next();

           char choiceModified = choice.toLowerCase().charAt(0);

           if (choiceModified == 'r') {

               int roll1 = rand.nextInt(6) + 1;

               int roll2 = rand.nextInt(6) + 1;

               int total = roll1 + roll2;

               System.out.println("Dice 1: " + roll1);

               System.out.println("Dice 2: " + roll2);

               if (total == targetSum) {

                   System.out.println("Target Sum of " + targetSum + " hit.");

                   break;

               }

           } else if (choiceModified =='q') {

               break;

           } else {

               System.out.println("Wrong choice");

           }

       }

   }

}

DESCRIBE THE GENERAL STRATEGY BEHIND DEALOCK PREVENTION AND GIVE A PRATICAL EXAMPLE

Answers

Answer:

........

Explanation:..........

Other Questions
How long is a bus journey that starts at 8.55 a.m. and ends at 9.17 a.m.? Please can you put the answer in minutes? Several vivid descriptions of the sea occur in this poem. Find your favorite. Copy it below and explain why it is your favorite. Find the unit price: 12 eggs for $3. How much is the cost per (one) egg?. 5.Exit Ticket:How can neighbors contribute to our neighborhood? Write your answers in complete sentences. Write at least 3-5 sentences. What would be the benefit of selling on Friday? help look at the pic Which statement or statements apply to a bond which is selling at a premium? I. The market value exceeds the par value. II. The selling rate is above 100. III. It is sold by corporations, not by the government. A. I and II b. I only c. III only d. I, II, and III. What's the most common sport in South America?A. FtbolB. Auto racingC. BaseballD. TennisSUBMIT There are 100 students in the sixth grade. The ratio of boys to girls is 2:3. How many more girls than boys are in the sixth grade? In your own idea, what is the root cause of a riot? A zookeeper is monitoring the population of gazelles. The herd needs to have exactly three times more males than females to thrive. The zoo only has room for a maximum of 12 female gazelles. Let x represent the number of female gazelles and y represent the number of male gazelles. Write the constraints that represent the possible number of male and female gazelles that can live in a thriving population at the zoo. X > 0 and y > 0 0 < x 12 and 0 < y 36 0 < x 12 and y > 36 x > 0 and y < 23. Jae bought 85 tickets to spend on games and rides at an amusement park. Games cost 3 tickets each, and rides cost 8 tickets each. Jae has already used 39 of the tickets. If he uses all of his remaining tickets for rides, how many more times can Jae go on rides? Directions on a box of 5 cups of wallpaper paste are to mix the contents with 4 qt of water. To mix a smaller batch using 1 cup of paste, how much water (in ounces) should be added? note that 1qt=32oz Does any know how to do paragraph proofs? The square below represents one whole.Express the shaded area as a fraction, a decimal, and a percent of the whole.Fraction: Decimal:Percent: Solve for X I will mark brainliest -7(-2 ( 3x+1)+ 4) +9 Select the correct answer from each drop-down menu. Scientists that reducing the consumption of substances that emit harmful gases would reduce pollution. Jonathan was irritated by the noise made by the loud musical procession on the street. The poor farmer was in for a pleasant surprise when he stumbled upon a pot of gold buried in his yard. pls help. will give brainliest :) solve pls brainliestCome up with 5 examples of oxymorons and use in sentences.