เฉลยข้อสอบคอมโปรฯ Q7

รับตัวเลขจำานวนเต็มบวกจากแป้นพิมพ์ นับจำานวนเลขคี่ จนกว่าจะใส่เป็น 0 แสดงผลลัพธ์ออกทาง
จอภาพ
ตัวอย่างผลรันเมื่อกรอก 1 2 3 4 5 6 7 8 9 0
Input an integer: 1
Input an integer: 2
Input an integer: 3
Input an integer: 4
Input an integer: 5
Input an integer: 6
Input an integer: 7
Input an integer: 8
Input an integer: 9
Input an integer: 0
Odd count = 5

ตัวอย่างผลรันเมื่อ กรอก 1 1 2 2 3 3 0
Input an integer: 1
Input an integer: 1
Input an integer: 2
Input an integer: 2
Input an integer: 3
Input an integer: 3
Input an integer: 0
Odd count = 4

Leave a Reply

อีเมลของคุณจะไม่แสดงให้คนอื่นเห็น ช่องข้อมูลจำเป็นถูกทำเครื่องหมาย *

This site uses Akismet to reduce spam. Learn how your comment data is processed.