i am really lost on this question. i need the java code for: -number between hi
ID: 3638318 • Letter: I
Question
i am really lost on this question. i need the java code for:-number between hi and lo inclusive, if number is perfect print it and space to out file. THE TEST FOR PRIME WILL BE A LOOP INSIDE THE OUTER LOOP.
I have some pseudocode and have been trying to find things on the internet but my professor really spends no time on this so I am really lost, especially as far as actually writing the code and the specific syntax for things. i especially don't know what to do after finding perfects, concerning what to put into the quotes to be printed to the outfile. some help on this would be really appreciated especially syntax-wise
Explanation / Answer
From what I am understanding, you want a snippet of code that finds perfect numbers from [lower_bound, upper_bound]. Then, you want to output that perfect number and a space right after. Then, you want to test if a number is a prime. I am not sure what is the point of this part if nothing is printed out. Some references for reading and writing to a file: http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileInputStream.html http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileOutputStream.html You may also want to look into the modulo operand. It basically can help you determine if a number n is divisible by a number m.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.