The Cross Sum Program

This miniprogram calculates the cross sum of an integer.

You need 2 textboxes and 1 commandbutton to get the program going.

How does it look like ? ( in German)

prgquer.png

Please beware of the signs / and \ . In this program the sign \ is used for a division without a rest.

The Code

PUBLIC SUB Button1_Click()
DIM z AS Integer
DIM crosssum AS Integer
z = Val(TextBox1.Text)
DO WHILE z <> 0 
crosssum = crosssum + z MOD 10
z= z \ 10 
LOOP 
TextBox2.Text = Str$(crosssum)
END

-- ReinerHoffmann - 31 Jan 2004