id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

gaurav.gupta@mq.edu.au recursion > diffDates1
prev  |  next  |  chance

Define a recursive function that when passed two dates in the same year (assume non-leap year), returns the difference (in days) between the two. For example, there is a two-day difference between 13/04/2011 and 15/04/2011. You may not use any loops. You may create helper functions if needed.


diffDates1(25, 7, 17, 8) → 23
diffDates1(15, 7, 31, 12) → 169
diffDates1(1, 1, 19, 11) → 322

...Save, Compile, Run (ctrl-enter)

int diffDates1(int day1, int month1, int day2, int month2) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 4 Post-solution available

Copyright Nick Parlante 2017 - privacy