(a)B contracts to build a ship for C for a given sum, to be paid by instalments as the work reaches certain stages. A becomes surety to C for B's due performance of the contract. C, without the knowledge of A, prepays to B the last two instalments. A is discharged by this prepayment.