While loop exiting before computation because of datatypes

后端 未结 3 1338
遇见更好的自我
遇见更好的自我 2021-01-28 09:37

My program specifications are as follows. 1. All four digits are different 2. The digit in the thousands place is three times the digit in the tens place 3. The number is odd. 4

3条回答
  •  鱼传尺愫
    2021-01-28 10:25

    Swap while(found) for while(!found).

    Just think about it logically. You don't want to look while you've found something. You want to keep looking while you've not found it.

提交回复
热议问题