I intend the code to run only if c is different from a square less than 36, otherwise try again ...
c<-sample((1:36),1) if(c==1|c==4|c==9|c==16|c==25|c==36){ }else{ }
Maybe a simplier condition:
if (c %in% (1:5)^2) {...}