source:
CIVL/examples/languageFeatures/sumExpression.cvl
| Last change on this file was b3cd4ba, checked in by , 3 months ago | |
|---|---|
|
|
| File size: 223 bytes | |
| Line | |
|---|---|
| 1 | $input int N; |
| 2 | $assume(N > 0 && N <= 10); |
| 3 | $input int a[N]; |
| 4 | |
| 5 | int main() { |
| 6 | int sum = 0; |
| 7 | for (int i = 0; i < N; i++) { |
| 8 | sum += a[i] + 1; |
| 9 | } |
| 10 | $assert(sum == $sum(int t : 0 .. N-1) a[t] + 1); |
| 11 | return 0; |
| 12 | } |
Note:
See TracBrowser
for help on using the repository browser.
