take out what you made then add the following: IF R>360 THEN R=0 INC N,1 PRINT N