其他分享
首页 > 其他分享> > do-while百钱百鸡

do-while百钱百鸡

作者:互联网

 1 /*百钱百鸡*/
 2 #include <stdio.h>
 3 #include <windows.h>
 4 
 5 int main() {
 6     int gj=0, mj=0, xj=0;
 7     //int i=1, j=1, k=1;
 8     //gj + mj + xj == 100;
 9     //gj * 5 + mj * 3 + xj / 3 == 100;
10         do {
11             do {
12                 do {
13                     if (gj + mj + xj == 100 && gj * 5 + mj * 3 + xj / 3 == 100 && xj % 3 == 0)
14                     {
15                         printf("%d %d %d\n", gj, mj, xj);
16                     }
17                     xj++;
18                 } while (xj < 99);
19                 mj++;
20                 xj = 1;
21             } while (mj <99);
22             gj++;
23             mj = 1;
24         } while (gj<99);
25         
26         system("pause");
27 }
View Code

 

标签:xj,do,int,mj,while,百鸡,100,gj
来源: https://www.cnblogs.com/pufan/p/12189518.html