100 money to buy hundred chicken problems
In the fifth century, my country's ancient mathematician Zhang Qiujian put forward the "Bai Chicken Question" in the book "Mandarin": Jixi's money is five, the chicken mother is worth a money three, and the chicken three-value money. Hundreds of money to buy hundreds of chicks, ask Chicken, chicken mother, chicken children?
Main () {int cocks, hens, chicks; cocks = 0; while (cocks <= 19) {HENS = 0; while (HENS <= 33) {Chicks = 100-cocks-hens;
if (5 * COCKS 3 * HENS Chicks / 3 == 100 && Chicks% 3 == 0) Printf ("% D,% D,% D / N", cocks, hens, chicks); Hens = Hens 1;} cocks = cocks 1;}}
Number of daffodils
Topic: Print all "Narcies", the so-called "number of daffodils" refers to a three-digit number, and its digital cubes and is equal to the number itself. For example: 153 is a "number of daffodils" because 153 = 1 triple square 5 three times. 1. Program analysis: Use the for loop to control 100-999 numbers, each number is broken down, ten, one hundred. 2. Program source code: main () {INT I, J, K, N; Printf ("'Water Flower'Number IS:"); for (n = 100; n <1000; n ) {i = N / 100 ; J = (Ni * 100) / 10; k = n% 10; if (i * i * i j * j * j k * k * k == n) Printf ("% d / n", n }}