worked out what was wrong with loop now working changed it to this
(Y=0; Y<X; Y++)