喝汽水,1瓶汽水1元,2個空瓶能夠換一瓶汽水,給20元,能夠買多少汽水

這道題主要是考察編程邏輯,必定要分清奇數個空瓶和偶數個空瓶,還有終止循環的條件。web int main() { int _bottle = 0;//當空瓶爲奇數個時,表示剩下的瓶子 int money = 20; int count = 0;//總共的汽水數 int bottle=0;//空瓶數 if (money > 0) {
相關文章
相關標籤/搜索