Sha256: ad2d0cb8b76686c155b5090a095f4000a94152704db50d7fe4f14dd730735602
Contents?: true
Size: 529 Bytes
Versions: 247
Compression:
Stored size: 529 Bytes
Contents
#include "sum_of_multiples.h" #include <stdbool.h> unsigned int sum_of_multiples(const unsigned int *multiples, const size_t number_of_multiples, const unsigned int upper_bound) { unsigned int sum = 0; for (unsigned int current = 1; current < upper_bound; current++) { for (size_t i = 0; i < number_of_multiples; i++) { if ((current % multiples[i]) == 0) { sum += current; break; } } } return sum; }
Version data entries
247 entries across 247 versions & 1 rubygems