Sha256: fa0ecae98e2cf8f62d010c362683757edae5b18a8bd187814752494369734e85
Contents?: true
Size: 594 Bytes
Versions: 133
Compression:
Stored size: 594 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; if (NULL == multiples) return sum; for (unsigned int current = 1; current < upper_bound; current++) { for (size_t i = 0; i < number_of_multiples; i++) { if (0 != multiples[i] && (current % multiples[i]) == 0) { sum += current; break; } } } return sum; }
Version data entries
133 entries across 133 versions & 1 rubygems