source:
CIVL/examples/languageFeatures/sumExpression.cvl@
bd7a43e
| Last change on this file since bd7a43e was bd7a43e, checked in by , 3 months ago | |
|---|---|
|
|
| File size: 213 bytes | |
| Rev | Line | |
|---|---|---|
| [bd7a43e] | 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]; | |
| 9 | } | |
| 10 | $assert(sum == $sum(int t, 0, N-1, a[t])); | |
| 11 | return 0; | |
| 12 | } |
Note:
See TracBrowser
for help on using the repository browser.
