Prova questo.

codice HTML:
for(x=0; x<50; x++){
   if (x % 5) == 0) {
       alert(x);
   }
}