Skip to content

Commit

Permalink
added p6 in cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ditekunov authored May 26, 2018
1 parent cafe458 commit f185af7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cpp/Problem6.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <iostream>

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;
}

0 comments on commit f185af7

Please sign in to comment.