Click here to Skip to main content
15,561,817 members

Comments by Ed Nutting (Top 200 by date)

Ed Nutting 21-Oct-13 16:54pm View    
Compile or run? Or both? I can do both if you like :p You're right, I don't know you, but I have an impression of you. If you don't like the impression I have got, you should consider the way you present yourself, not the way that I respond. In practical terms, you ought to flesh out your question more and perhaps even comment your code. Anyway, I hope your problem is solved.

Ed
Ed Nutting 21-Oct-13 13:46pm View    
:)
Ed Nutting 21-Oct-13 12:44pm View    
Your code for generating the Fibonacci sequence would be fine if you just removed the "% 10". Put the "% 10" outside the loop i.e. "println(fibo_2 % 10)" which should then get you the answer you want.

I suggest you read this: http://www.math.toronto.edu/mccann/assignments/199S/FibModK.pdf
If you don't understand at least the first page, then you should give up on this problem.
If you understand the first page, but don't bother reading the rest because you think you already know it, give up programming.
If you understand all of it but can't solve your problem, go ask on a maths forum for a better explanation.

All the best,
Ed

Advice on a crude but perhaps more obvious method: Generate an array of last digits for n=1 to 60, then when asked for last digit of Xth element, index into your array at X%60. Job done.
Ed Nutting 21-Oct-13 12:31pm View    
I can answer the second bit for him: solving his homework. The "0.5 seconds" requirement just screams "theoretical h/w question"!

Ed :)
Ed Nutting 21-Jul-13 6:52am View    
Hahahahaha clearly you haven't done this before - you need to actually ask a question before anyone can help you :) Perhaps try giving some details about the error you are getting and even try finding a place for a question mark. And if you find yourself thinking "Who's this guy? Why is he acting like he's better than me?", try looking at my profile.

Good luck improving your "question".
Ed