Factorial Program In Java Using Thread
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upJava program to calculate the factorial of a given number using while loop Java Programming Java8 Object Oriented Programming A factorial of a particular number (n) is the product of all the numbers from 0 to n (including n) i.e. Factorial of the number 5 will be 1.2.3.4.5 = 120. Java Program for factorial of a number. Bc drivers license learners restrictions after hysterectomy. Factorial of a. Java program to find factorial of given number. One line Solution (Using Ternary operator).
DOWNLOAD EPISODE NARUTO VS PAIN SUBTITLE INDONESIA Aerad DOWNLOAD EPISODE NARUTO VS PAIN SUBTITLE INDONESIA. Download Naruto Vs Pain Full Episode No Part But Sub.Inggris. Tag: Anime, Film & Movie. Kali ini saya akan share video naruto shippuden, Free Download Naruto Shippuden Full Episodes Lama dan Terbaru Lengkap Mulai. Download Naruto Vs Pain Subtitle Indonesia, Anime Naruto Indonesia, Download Naruto Vs Pain Subtitle Indonesia. Silahkan didownload sebagai pelengkap Fairy Tail Subtitle Bahasa Indonesia Video Film Anime Fairy Tail. Kata Mutiara/Bijak Uzumaki Naruto di Anime Naruto. Anime AKB0048 Episode Subtitle Indonesia; Download One Piece The. Naruto 2019,naruto 2019 trailer,naruto vs,naruto vs sasuke,naruto vs pain,naruto shippuden,madara uchiha,naruto and sasuke vs madara,naruto vs madara,naruto vs madara english dub full fight,naruto. Download Naruto Vs Pain Full Movie Sub Indo; Subtitle Indonesia. Silahkan di download. Mr.Bean Tips dan Trik Movie Naruto Softwere. Antares autotune for cool edit pro 2.1 free download. Saya ingin berbagi kepada kalian video 'naruto vs pain' full 3gp dari. Download Naruto Vs Pain Full Movie Bahasa Indonesia video fo free.
1 contributor
packagecom.rmal.javaOOP.multithreading.lesson6.task1; |
/*1) Создайте сто потоков которые будут вычислять факториал |
числа равного номеру этого потока и выводить результат на |
экран.*/ |
importjava.math.BigInteger; |
classFactorialimplementsRunnable { |
privateint number; |
publicFactorial(intnumber) { |
this.number = number; |
} |
publicFactorial() { |
super(); |
} |
publicintgetNumber() { |
return number; |
} |
publicvoidsetNumber(intnumber) { |
this.number = number; |
} |
privateBigIntegercalculateFactorial(intnumber) { |
BigInteger result =newBigInteger('1'); |
for (int i =1; i <= number; i++) { |
result = result.multiply(newBigInteger(''+ i)); |
} |
return result; |
} |
@Override |
publicvoidrun() { |
Thread th =Thread.currentThread(); |
th.setName('Thread № '+ number); |
System.out.println(th.getName() +':'+'!'+ number +' = '+ calculateFactorial(number)); |
} |
} |
Copy lines Copy permalink
- Related Questions & Answers
- Selected Reading
A factorial of a particular number (n) is the product of all the numbers from 0 to n (including n) i.e. Factorial of the number 5 will be 1*2*3*4*5 = 120.
- 1. To find the factorial of a given number.
- 2. Create a variable factorial initialize it with 1.
- 3. start while loop with condition i (initial value 1) less than the given number.
- 4. In the loop, multiple factorials with i and assign it to factorial and increment i.
- 5. Finally, print the value of factorial.