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
Dafna11 [192]
3 years ago
9

Debug the program so it prints the factorial of a positive integer entered by the user. This is calculated by multiplying all th

e numbers from 1 up to that number together. For example, 5 factorial is 5*4*3*2*1 = 120.
import java.util.Scanner;

public class U4_L1_5_Activity_Two{
public static void main(String[] args){

Scanner scan = new Scanner(System.in);
int num = scan.nextInt();
while(num >= 0){
int prod = 1;

prod = prod*num;
System.out.print(prod);
num--;
}


}
}
Computers and Technology
1 answer:
Monica [59]3 years ago
3 0

Your main problem was declaring int prod in the while loop. This caused prod to be reset back to 1 every time the while loop ran.

You might be interested in
How do you start using the Internet?
fgiga [73]

Answer:

it's

D. open web browser

3 0
3 years ago
Read 2 more answers
Create a query that shows columns employee last name, job title and hire date for those employees who joined the company on or a
yawa3891 [41]

Answer:

SELECT last_name, job_title, hire_date FROM employee WHERE hire_date>="01-12-2016" AND job_title != "STOCK CLERK" ORDER BY job_title DESC;

Explanation:

The SQL code queries the employee table returning records of the last_name, job_title, and hire_date columns matching the employees hired on or after December 2016 and job titles that are not stock clerks in the employee table.

The WHERE and AND clause is responsible for the condition while the ORDER BY clause returns the query result in the of the job title in descending order.

3 0
3 years ago
Jacek has just started a new job as a sales clerk, and his first task is to create a new sales invoice. Which Microsoft software
g100num [7]

Answer:

Microsoft Excel

Explanation:

Microsoft Excel is a Microsoft application package. It is a spreadsheet application used to analyse and manipulate data. It has columns which are referred to fields and rows also known as records.There are various features in excel that used to create statistical and graphical esctasies and data presentations.

It can be used to create template for CVs/resumes, Bank draft, receipts and invoice etc.

5 0
3 years ago
The ____ causes the network to settle into a stable state where it can correctly respond, to any desired degree of accuracy, to
Tema [17]

Answer:

The back propagation algorithm causes the network to settle into a stable state where it can correctly respond, to any desired degree of accuracy, to all inputs in the training set.

Explanation:

Back propagation algorithm is a part of the learning of a neural network. In a simple neural network setting at each iteration;

  • The network<em> </em>assumes <em>random weights</em>  at each network layer and passes the value to the next trough an <em>activation function</em>.
  • Then a loss function is calculated by comparing the distace of the final value with the label value using a predetermined distance metric.
  • The weights are optimized trough back propagation

Thus, back propagation algorithm used to reach the final weights of the neural network, so that it can work more accurately.

3 0
4 years ago
What explains the discrepancy between the number of bytes you can
sergejj [24]

Answer:

This is because, the advertisers report the storage space in decimal while the computer reads the storage space in binary.

Explanation:

The advertisers report the storage space in decimal or base 10 because humans count in decimal, whereas the computer reports the storage space in binary or base 2.

Since the computer storage is in bytes and 8 bits equal 1 byte, It is easier to write a storage space of 1 kB as 1000 B but it is actually supposed to be 1024 B(2¹⁰). So, there is a discrepancy of 1024 B - 1000 B = 24 B.

As  we go higher, the discrepancy increases. For example, 1 MB is advertised as 1000 kB = 1000000 B but is actually supposed to be 1024 kB = 1024 × 1024 B = 1048576 B. So, there is a discrepancy of 1048576 B - 1000000 B = 48576 B.

So, the actual number of bytes on the storage device is actually less than that reported due to the different number systems in which they are reported in. This discrepancy is less in memory cards or flash drives though in which the stated value of storage capacity might be the actual storage size.

Note that the base 10 or decimal system was chosen by advertiser since this is what consumers understand.

8 0
3 years ago
Other questions:
  • .How does kinetic energy affect the stopping distance of a vehicle traveling at 30 mph compared to the same vehicle traveling at
    13·1 answer
  • Answer the following
    11·1 answer
  • Need help . business and technology
    11·1 answer
  • As text is typed in the _____ text box, a drop-down list displays options for completing the action, displaying information on t
    11·1 answer
  • A Color class has a constructor that accepts three integer parameters: red, green and blue components in the range of 0 ... 255
    6·1 answer
  • Fuction table of JK-Flip flop?
    11·1 answer
  • My PC won't output any data does anyone have any ideas​
    9·1 answer
  • Which scenario describes unethical lab behavior?
    9·1 answer
  • How to deactivate the brainly app?​
    12·2 answers
  • Tell four permanent icons on the desktop​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!