Datasets:

ArXiv:
License:
File size: 581 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * FindSumOfNumbers will count the sum of the number from 1 to the parameter
 * countUntil and then write the result to the console.
 * 
 * FindSumOfNumbers is the task which will be performed
 *
 * @author Akash Das
 *
 */
public class FindSumOfNumbers implements Runnable {
    private final long countUntil;

    FindSumOfNumbers(long countUntil) {
        this.countUntil = countUntil;
    }

    @Override
    public void run() {
        long sum = 0;
        for (long i = 1; i < countUntil; i++) {
            sum += i;
        }
        System.out.println(sum);
    }
}