Skip to content

Commit

Permalink
solved problem 19 in cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
timostrating committed Aug 21, 2019
1 parent b65b72b commit 2cf2229
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cpp/Problem019_CountingSundays.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <iostream>
using std::cout;

int main ()
{
float daysInYear = 365.25;
float amountOfYears = 100.0;

float changeIsSunday = 1.0 / 7.0;
float changeIsFirstDayOfTheMonth = 1.0 / (daysInYear / 12.0);

cout << int(daysInYear * amountOfYears * changeIsSunday * changeIsFirstDayOfTheMonth);
return 0;
}

0 comments on commit 2cf2229

Please sign in to comment.