Problem 1 solution
More...
#include <stdio.h>
|
int | main () |
| Main function.
|
|
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.
13{
14 int t;
15 printf("Enter number of times you want to try");
16 scanf("%d", &t);
17 while (t--)
18 {
19 unsigned long long N, p = 0, sum = 0;
20 printf("Enter the value of N ");
21
22 scanf("%lld", &N);
23 for (int i = 0; i < N; i++)
24 {
25 if (i % 3 == 0 || i % 5 == 0)
26 {
27 sum = sum + i;
28 }
29 }
30 printf("%lld\n", sum);
31
32 }
33 return 0;
34}