Divisible by both · หารด้วยทั้งสองลงตัว
Divisible by both
n is 12. Print yes when n divides exactly by both 3 and 4, and no otherwise.
This is the shape a leap-year test is built from: a remainder question, == 0, and and between two of them. Each side must be a whole question — n % 3 == 0 and n % 4 == 0.
หารด้วยสองจำนวนได้พอดี
n คือ 12. ให้พิมพ์ yes เมื่อ n หารด้วย ทั้ง 3 และ 4 ลงตัว และพิมพ์ no ในกรณีอื่น ๆ
นี่คือโครงสร้างของการเขียนเงื่อนไขปี(files year): คำถามเกี่ยวกับเศษเหลือ, ตัวแปร == 0, และการเชื่อมด้วย AND/OR (and) ระหว่างสองส่วน โดยแต่ละด้านต้องเป็นคำถามที่สมบูรณ์ — เช่น n % 3 == 0 and n % 4 == 0
n is 12. Print yes when n divides exactly by both 3 and 4, and no otherwise. · n คือ 12. ให้พิมพ์ yes เมื่อ n หารด้วย ทั้ง 3 และ 4 ลงตัว และพิมพ์ no ในกรณีอื่น ๆ
Click Run to see the output here. · คลิก Run เพื่อดูผลลัพธ์ที่นี่