source:
CIVL/examples/languageFeatures/comma.cvl@
bb03188
| Last change on this file since bb03188 was ea777aa, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 250 bytes | |
| Rev | Line | |
|---|---|---|
| [3689f18f] | 1 | /* This example demonstrates the use of comma operators. |
| 2 | * It has no violation. | |
| 3 | */ | |
| [e6b02c8] | 4 | #include<civlc.cvh> |
| [e9aad2c] | 5 | |
| [3689f18f] | 6 | $input int n=5; |
| [e9aad2c] | 7 | |
| 8 | void main() { | |
| 9 | int i,j, k; | |
| 10 | ||
| 11 | k = 0; | |
| 12 | for (i=0, j=1; i<=n; i++,j++) { | |
| 13 | k += i*j; | |
| 14 | } | |
| [d980649] | 15 | $assert(k == n*(n+1)*(n+2)/3); |
| [e9aad2c] | 16 | } |
Note:
See TracBrowser
for help on using the repository browser.
