Stuck on this problem:
Given an integer num, return the sum of the multiples of num between 1 and 100. For example, if num is 20, the returned value should be the sum of 20, 40, 60, 80, and 100, which is 300. If num is not positive, return 0.
the code I already have (I'm not sure if it's at all right) is:
public int sumMultiples(int num)
{
int sum = 0;
for (int val = num; val <= 100; val++)
sum = val;
return sum;
}
sum = val
do to start with.