0 Basics C# Notes 04: Buying a Hundred Chickens for a Hundred Money


foreword

Classical math problems:

  • A rooster costs 5 yuan, a hen costs 3 yuan, and three chicks cost 1 yuan
  • I have 100 coins and just bought 100 chickens. How can I buy them?

the code

Method 1: Two layers of loop

for(int i = 0; i <= 20

Guess you like

Origin blog.csdn.net/BeanGo/article/details/131755260