answer.
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]
1 year 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]1 year 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
Is cheque money? give reason​
Andreas93 [3]

Answer:

Cheque is not money. cheque is a paper instructing the bank to pay a specific amount from the person's account to the person in whose name the cheque has been drawn. The facility of cheque against demand deposits makes it possible to directly settle the payments without the use of withdrawal.

Explanation:

7 0
2 years ago
What infrastructure model provides access to shared computing resources over a network, often the internet?
Goshia [24]
Cloud computing infrastructure model provides access to shared computing resources over a network, often the internet. The cloud computing infrastructure is a virtual infrastructure composed of hardware and software components <span>needed to support the </span>computing<span> requirements of a </span>cloud computing model.And the cloud computing model is <span>the delivery of computing services (servers, storage, databases, networking, software, analytics and more) over the Internet .</span> 
7 0
2 years ago
What is the area of a parallelogram whose vertices are A(−1, 12) , B(13, 12) , C(2, −5) , and D(−12, −5) ? Enter your answer in
11Alexandr11 [23.1K]
<span>Looking at the first two vertices, A and B, we see that the x values have a difference of (-1 - 13) units, or 14 units. This gives us the base of the parallelogram. Next, we look at the difference between the y values between B and C to find the height. In this case, they are (12 - [-5] ) units, or 17 units. The area of a parallelogram is simply base multiplied by height, which is (14 * 17), or 238 square units.</span>
3 0
2 years ago
Read 2 more answers
Explain why types of technology valued can vary
Viefleur [7K]
Types of technology valued can vary because all technology is unique to its category so to speak. you have to realize a fork is a former of technology. just as much as a microwave is
6 0
2 years ago
Read 2 more answers
Adele’s mother owns a Daycare and she wants to learn all about this business, to help her mom and own it one day. Which CTSO sho
Gennadij [26K]

Answer:

She should join the Future Business Leaders of America–Phi Beta Lambda

Explanation:

CTSOs are Career and technical student organizations. These organizations are vocational and extracurricular groups based primarily in high schools, colleges and career technological centres, for students in Career and Technical Education. They are important parts of the high school and college programs.

The Future Business Leaders of America–Phi Beta Lambda prepares students to become community-minded business leaders. It provides opportunities to learn career skills and gain leadership experience.

Therefore Adele should pick this CTSO

7 0
2 years ago
Other questions:
  • Name an analog quantity other than temperature and sound.
    14·1 answer
  • Name and summarize the four levels of administration necessary to keep human services organization operating smoothly
    9·2 answers
  • Tina reported a safety hazard at her workplace to OSHA. Representatives from OSHA
    5·1 answer
  • Write a class called Counter that represents a simple tally counter, which might be used to count people as they enter a room. T
    9·1 answer
  • Axel is finally documenting his work. What could he be writing?
    12·1 answer
  • Which statement about dialogues is NOT correct? Select one: A. Users should be able to control the direction of speed of dialogu
    5·1 answer
  • Write a C program that inputs four strings that represent integers, converts the string to integers, sums the values and prints
    10·1 answer
  • Program documentation _____. Group of answer choices describes the inputs, outputs, and processing logic for all program modules
    6·1 answer
  • External network security threats can include management failure to support organization-wide security awareness, inadequate sec
    12·1 answer
  • What does NOT match with Agile Manifesto?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!