Skip to content

Instantly share code, notes, and snippets.

@peterkos
Last active September 24, 2016 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterkos/68311cb3c31274cd2f62 to your computer and use it in GitHub Desktop.
Save peterkos/68311cb3c31274cd2f62 to your computer and use it in GitHub Desktop.
Inputs two integers and outputs an integer with a fake decimal, i.e. (int division result).(remainder)
private static int addTwoIntegers(int firstValue, int secondValue) {
int intResult = 0;
int remainderResult = 0;
intResult = firstValue / secondValue;
remainderResult = firstValue % secondValue;
System.out.printf("firstValue divided by secondVlaue is %s.%s\n", intResult, remainderResult);
//Same as above statement, but with println instead of printf
//System.out.println("firstValue divided by secondValue is " + intResult + "." + remainderResult);
return intResult;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment