Approach
-
Used a for loop starting from i=a.
-
Increased i by d each time.
-
Stoped when value of i exceeds b.
-
If the number is even (i % 2 == 0), add it to evenSum.
-
Print the final sum.
-
Time Complexity -> O((p) where p=(b-a)/d
-
Space Complexity -> O(1)