I have seen some solution here for the same problem, this and this I have found better ways to solve this problem. I just want to know how good or bad my code and way of approaching this problem is.
using System;
public class Program
{
public static void Main()
{
int sum = 0;
for (int i = 0; 3 * i < 1000; i++)
{
sum += 3 * i;
if (5 * i < 1000 && (5 * i) % 3 != 0)
{
sum += 5 * i;
}
}
Console.WriteLine(sum + "");
}