diff options
Add Pract. solutions.
1 files changed, 15 insertions, 0 deletions
| -rw-r--r-- | pract_SI/Pract. 09/task9.cpp | 15 |
diff --git a/pract_SI/Pract. 09/task9.cpp b/pract_SI/Pract. 09/task9.cpp new file mode 100644 index 0000000..2c0bd58 --- /dev/null +++ b/pract_SI/Pract. 09/task9.cpp @@ -0,0 +1,15 @@ +void printLeapYears(unsigned year, unsigned N) +{ + if (N == 0) + return; + + if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) + { + cout << year << endl; + return printLeapYears(year + 4, --N); + } + else if(year % 100 == 0) + return printLeapYears(year + 4, N); + + return printLeapYears(year + 1, N); +}
\ No newline at end of file |
