source:
CIVL/examples/arithmetic/mean.cvl@
6a4e2e0
| Last change on this file since 6a4e2e0 was 8fa5a7b, checked in by , 13 years ago | |
|---|---|
|
|
| File size: 292 bytes | |
| Line | |
|---|---|
| 1 | $input int N_BOUND; |
| 2 | #pragma TASS input {N>0 && N<=N_BOUND} |
| 3 | $input int N; |
| 4 | #pragma TASS input |
| 5 | double a[N]; |
| 6 | #pragma TASS output |
| 7 | double s; |
| 8 | |
| 9 | void main() { |
| 10 | int i=0; |
| 11 | double x=0.0; |
| 12 | |
| 13 | $assume |
| 14 | #pragma TASS joint invariant LOOP true; |
| 15 | while (i < N) { |
| 16 | x = x + a[i]; |
| 17 | i = i + 1; |
| 18 | } |
| 19 | s = x/N; |
| 20 | } |
| 21 |
Note:
See TracBrowser
for help on using the repository browser.
