Professional Documents
Culture Documents
1. Write a suitable contract for this loop such that the assertions on lines 9 and 10 are proved
as well as the contract of the loop.
void foo(){
int i ;
int x = 0 ;
for(i = 0 ; i < 20 ; ++i){
if(i == 19){
x++ ;
break ;
}
}
9: //@ assert x == 1 ;
10: //@ assert i == 19 ;
}