subject

JAVA PROGRAMMING, WILL GIVE BRAINLIEST, PLS Here are the instructions:
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.

Here is the code:
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;
num--;
prod = prod*num;
}
System. out. println(prod);

}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
question
Computers and Technology, 23.06.2019 10:50
The volume v and paper surface area a of a conical paper cup are given by where r is the radius of the base of the cone and h is the height of the cone. a. by eliminating h, obtain the expression for a as a function of r and v. b. create a user-de ned function that accepts r as the only argument and computes a for a given value of v. declare v to be global within the function. c. for v ! 10 in.3 , use the function with the fminbnd function to compute the value of r that minimizes the area a. what is the corresponding value of the height h? investigate the sensitivity of the solution by plotting v versus r. how much can r vary about its optimal value before the area increases 10 percent above its minimum value?
Answers: 1
question
Computers and Technology, 23.06.2019 12:50
Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
You know the right answer?
JAVA PROGRAMMING, WILL GIVE BRAINLIEST, PLS Here are the instructions:
Debug the program so i...
Questions
question
English, 19.04.2021 14:00
question
English, 19.04.2021 14:00
question
German, 19.04.2021 14:00
question
Physics, 19.04.2021 14:00
Questions on the website: 13722361