subject

Debug the program so it prints the factorial of a positive integer entered by the user. This is calculated by multiplying all the 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--;
}

}
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:40, debo4965
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
image
Computers and Technology, 22.06.2019 15:30, gudon986732
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, 710jonathan
The following is an excerpt from a slide presentation. today we will inverse operations solving equations using inverse operations solving inequalities using inverse operations from which part of the presentation does the slide most likely come from? a. introduction b. outline c. body d. conclusion
Answers: 1
image
Computers and Technology, 23.06.2019 03:00, Julianhooks
State 7 common key's for every keyboard
Answers: 1
You know the right answer?
Debug the program so it prints the factorial of a positive integer entered by the user. This is calc...

Questions in other subjects:

Konu
Mathematics, 26.02.2021 22:10