5. ข้อความ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 5-6  ตัวอย่างการใช้ for เพื่อทดสอบจำนวนเฉพาะ
int k;
for(k=2; k<n && (n%k)!=0; ) {
  k++;
}

int k; for(k=2; k<n && (n%k)!=0; ) k++;
int k; for(k=2; k<n && (n%k)!=0; k++) { }
int k; for(k=2; k<n && (n%k)!=0; k++) ;
©2009 S.Prasitjutrakul