Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
添加时生成/输出 3 个数字(从 1 到 20 的任意组合)的 C prog 等于 20。希望你能帮我解决这个问题。提前致谢。
int main(){ int num1,num2,num3,sum; do{ printf("%i+%i+%i=%i\n",num1,num2,num3,sum); } while(sum=20); getch(); }
试试这个。您应该能够根据需要对其进行修改。
#include<stdio.h> int main() { int i,j,k; for(i=1;i<=20;i++) for(j=1;j<=20;j++) for(k=1;k<=20;k++) if(i+j+k==20) printf("%d %d %d\n",i,j,k); return 0; }