Problem 1 solution
More...
#include <stdio.h>
Problem 1 solution
An Efficient code to print all the sum of all numbers that are multiples of 3 & 5 below N.
◆ main()
Main function.
15 printf(
"Enter number of times you want to try");
19 unsigned long long N, p = 0, sum = 0;
20 printf(
"Enter the value of N ");
24 sum = ((3 * p * (p + 1)) / 2);
27 sum = sum + ((5 * p * (p + 1)) / 2);
30 sum = sum - ((15 * p * (p + 1)) / 2);
31 printf(
"%lld\n", sum);