Created
September 23, 2015 03:18
-
-
Save jononon/5c1608e04ad67e702dd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class intester { | |
public static void main (String args[]) { | |
int testInt = 135; | |
int sum = 0; | |
sum = testInt%10; //adds 5 to the sum | |
testInt=testInt/10; //devides the test int by 10 | |
sum = sum + testInt%10; //adds 3 to the sum | |
testInt=testInt/10; //devides the test int by 10 | |
sum = sum + testInt%10; //adds 1 to the sum | |
System.out.println(sum); //returns 9 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment