You are on page 1of 1

Laboratory 6

Ap1.

Create a new class: Lab_06_1_surname_name

For a series of numbers calculate the factorial of numbers

𝑛! = 𝑛 ∙ (𝑛 − 1) ∙ (𝑛 − 2) ∙ … ∙ 2 ∙ 1

At the end of the program the user will be asked if he wants to run the program again by
typing with y for yes and n for no

One way to implement it is:

Scanner kbd = new Scanner(System.in);


char c;

...

do{

... // put here all program except declaration

System.out.print("Do you want to run the program again? [y/n]: ");


c=kbd.next().charAt(0);
}while(c=='y');

You might also like