Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static int oddSum(final int left, final int right) {
- if (right<=left)
- return 0;
- if (right % 2 == 0)
- return oddSum(left+1,right);
- else
- return oddSum(left+1,right)+1;
- }
- // just for testing ...
- public static void main(String[] args) {
- System.out.println(oddSum(2,5));
- // Den Rumpf dieser Methode können Sie ohne Auswirkung auf die Korrektheit der Lösung beliebig verändern.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement