-
August 8th, 2013, 03:15 PM
#1
Idiot/Noob HelpLine :) <----------HERE
Hey guys im rather new to programming and I have a newbie question for you:
I am making a program as a project, that's purpose is to tell whether a number is divisable by 1,2,3,4,5,6,7,8,9 and/or 10.
So far I have the graphic parts done like JOptionPanes and SystemOuts but I am stuck on the Calculation Parts. I need the program to separate the digits in a potentially 200 digit long number and "read" them. Here is an Example of one of the Equations i need to do:
To tell whether a number is divisable by 11 you must take the even number places (reading left to right: odd,even,odd,etc.), add them up, then add all the odd places, then take the sums, and subtract the evens from the odds.
So... Fairly specifically... how would I do this? (Please include all var's and associated scanners: Remember Im new at this)
Thanks,
JB
-
August 9th, 2013, 03:15 AM
#2
Re: Idiot/Noob HelpLine :) <----------HERE
All you have to do is to use modulo operator. If you don't know what modulo operator is, see wiki http://en.wikipedia.org/wiki/Modulo_operation or simple example here: http://www.cprogramming.com/tutorial/modulus.html.
-
August 9th, 2013, 02:46 PM
#3
Re: Idiot/Noob HelpLine :) <----------HERE
Hey Luke aor anybody else... If I could have a java example of the modulo operator that would be great! Thanks!
Last edited by percy121; August 12th, 2013 at 12:39 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|