This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = 100000000; | |
print '\nFinding sum of multiples of 3 and 5 below %d' % n | |
total = 0; | |
for i in xrange(0, n): | |
if i % 3 == 0 or i % 5 == 0: | |
total += i | |
print 'Result: %d' % total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n = 100000000; | |
printf("\nFinding sum of multiples of 3 and 5 below %d\n", n); | |
long total = 0; | |
for (int i = 0; i < n; ++i) { | |
if (i % 3 == 0) { |