C++ 计算机关数字总和 - 编程实现
#include\x20
int\x20main()\x20{ \x20\x20int\x20n; \x20\x20cin\x20>>\x20n;\x20//\x20输入行数 \x20\x20int\x20sum\x20=\x200; \x20\x20for\x20(int\x20i\x20=\x201;\x20i\x20<=\x20n;\x20i++)\x20{ \x20\x20\x20\x20for\x20(int\x20j\x20=\x201;\x20j\x20<=\x20i;\x20j++)\x20{ \x20\x20\x20\x20\x20\x20sum\x20+=\x20j;\x20//\x20将每行数字累加到总和中 \x20\x20\x20\x20} \x20\x20} \x20\x20cout\x20<<\x20sum\x20<<\x20endl;\x20//\x20输出总和 \x20\x20return\x200; }
原文地址: https://www.cveoy.top/t/topic/p4Xv 著作权归作者所有。请勿转载和采集!