summary refs log tree commit diff
path: root/tests/pracownia4/00_sum.xi
blob: 1ed3aa2056ef661a61a2dd207574f8f717910292 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
printInt(x:int)

sumtab(xs:int[]):int {
    sum:int = 0
    i:int = 0
    n:int = length(xs)
    while (i < n) {
        sum = sum + xs[i]
        i = i + 1
    }
    return sum
}

main():int
{
    xs:int[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
    printInt(sumtab(xs))
    return 0
}

//@PRACOWNIA
//@out 45
//@out Exit code: 0