Sha256: 94d64f4f44ad6287f3e93f18c315c4e2dcc70d93b4f02b9e6d038a6ec4d69633
Contents?: true
Size: 497 Bytes
Versions: 396
Compression:
Stored size: 497 Bytes
Contents
#include "difference_of_squares.h" unsigned int sum_of_squares(unsigned int number) { unsigned int sum = 0; for (unsigned int i = 0; i <= number; i++) { sum += i * i; } return sum; } unsigned int square_of_sum(unsigned int number) { unsigned int sum = 0; for (unsigned int i = 0; i <= number; i++) { sum += i; } return (sum * sum); } unsigned int difference_of_squares(unsigned int number) { return (square_of_sum(number) - sum_of_squares(number)); }
Version data entries
396 entries across 396 versions & 1 rubygems