Commits

Lars Yencken committed 3f7574d

C++ 01.

Comments (0)

Files changed (2)

cpp/01-sum-numbers.cpp

+/*
+ *
+ *  01-sum-numbers.c
+ *  euler
+ *
+ *  Created by Lars Yencken on 2012-02-29.
+ *  Copyright 2012 Lars Yencken. All rights reserved.
+ *
+ */
+
+#include <iostream>
+
+using namespace std;
+
+int main(int argc, const char *argv[])
+{
+	int sum = 0;
+
+	for (int i = 1; i < 1000; ++i)
+	{
+		if (i % 3 == 0 || i % 5 == 0)
+		{
+			sum += i;
+		}
+	}
+	cout << sum << endl;
+	return 0;
+}
+01-sum-numbers: 01-sum-numbers.cpp
+	$(CXX) -o $@ $<
+
+clean:
+	rm -f 01-sum-numbers