posted 5 years ago

Question-Write a java program to compute the first 25 prime numbers. Also compute the first 50 Fibonacci numbers given by fn=fn-1 +fn-2 with f1 =f2=1.create two thread to compute each one of them .set the priority of thread that compute Fibonacci number to 8 and the other to 5.After calculating 50 Fibonacci number, make that thread to sleep and take up prime number computation. After computing the 25 prime numbers continue the Fibonacci number computing.

Help For writing code

Help For writing code

posted 5 years ago

Welcome Will.

Wiser men than me told me that it is imperative that you first work out the logic on a piece of paper using a pencil. Lets start with writing the logic for calculating first 25 prime numbers, shall we? I assume you do know what a prime number is, a number which is divisible by only 1 and the number itself. What you have to do is just try out writing the code for it. Try yourself to write it. What exactly is it that you need assistance with? You do know the basics of the Java language . Am I right?

Wiser men than me told me that it is imperative that you first work out the logic on a piece of paper using a pencil. Lets start with writing the logic for calculating first 25 prime numbers, shall we? I assume you do know what a prime number is, a number which is divisible by only 1 and the number itself. What you have to do is just try out writing the code for it. Try yourself to write it. What exactly is it that you need assistance with? You do know the basics of the Java language . Am I right?

~ Mansukh

It is sorta covered in the JavaRanch Style Guide. |