diff --git a/cpp/Problem6.cpp b/cpp/Problem6.cpp new file mode 100644 index 0000000..aa18eee --- /dev/null +++ b/cpp/Problem6.cpp @@ -0,0 +1,19 @@ +#include + +int main(int argc, const char * argv[]) { + + unsigned int start_time = clock(); + + float sm = 100 * (100+1)/ 2; + float squared = (100 * (100 + 1) * (2 * 100 + 1)) / 6; + + std::cout << sm * sm - squared; + + + unsigned int end_time = clock(); + unsigned int finish = end_time - start_time; + + std::cout << "Program took" << finish*0.001 << "seconds"; + + return 0; +}