JAVA数字求和

时间:2023-12-27 17:40:13

设计思想:把子符串转换成数字,通过Integer.parseInt(),然后通过循环求和。

流程图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAbgAAAHzCAIAAADdN59LAAAgAElEQVR4nO3d0VMUd6Lo8an9E855SZV54+m+7WPq1L7dB6ruY06lbqqsSu25Z3P2YHZrqRyzySY357IuN1my2aRWsq7EMtEbFYzBbJTokTXCiBqNQaJRECYoyoKACIqIAoN9H9p02unu33RP/7p/3b/f91NUahh6en78nPmmfzD0FKxMWl5ebmpq2r59u+qBAIBVUD2AQHNzc4QyX2ZnZy9evHjx4sXZ2VnVYwFkym4okSNXrlzZs2fPsWPHhoaGhoaGent7Ozo6rly5onpcgByEEnGdOHGit7f3wYMHlmXNz8/Pz89bllUul/v6+orFourRARIQSsRy5cqV3t5ey7JKpdLevXu7u7uPHj3a0dExNDRkWdapU6dKpZLqMQJxEUrEsmfPngcPHpRKpcOHD6+srNhXrqysHDlyZHBwsFwud3R0rK2tqR0kEBOhRO1mZ2ePHTtmWdbevXudStrK5fLu3bstyyoWizMzM2rGB0hCKFG7ixcvDg0Nzc/Pd3d3O1eurKx89dVXp0+f3rt37+zs7NDQ0IEDB06fPt3f38+hJXJKTiiXHqwevzjx8fGR4xcnlh6sStknss8J5dGjR93Xl0qlU6dOjY+PT01NTU1NjY+Pf/nllxMTE6rGCcQkJ5Q958c/6St9NTz1SV/pi2/GpewT2Tc7O2v/Jmfv3r3lctn9pVKpdObMmbW1tbW1tTNnzlBJ5JqcUNqVtCzrq+Gpj4+PSNkncmH37t3lcnloaKi7u9vdyrW1tVKp9Ne//vXAgQNUEnkn84jy65FpjihNUyqV+vr6LMsaHBzcvXt3b29vsVjs7Ow8efKk/VUqCQ3ICeW9B6v/9fW1jt7hw2fH7vEzSsN88cUXp06dsg8nZ2dn7Recd3V1jY2NqR4aIIe033oPXr/V0Tt8/spNWTt06+npOXv2bBJ7hhSlUunjjz/u6+srlUqDg4NHjx7dvXv3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IZSIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqiTS4MRuIiVDqqbGzng/3h+p/EOQboQSAKgglAFRBKAGgCkIJAFUQSgCoglACQBWEEgCqIJQAUAWhBIAqCCUAVEEoAaAKQgkAVRBKAKiCUAJAFf8fvRarWBr2Pl0AAAAASUVORK5CYII=" alt="" />

package demo;       //名为demo的包
/*Eclipse开发环境熟悉
* 杜泽坤
* 2016/9/19
*/ public class CommandParameter { //CommandParameter类
public static void main(String args[]){ //main方法
int sum=0;
System.out.println("参数个数:"+args.length); //输出要输入参数个数
for(String arg:args){
System.out.println(arg); //输出所要求的几个参数
for(int i=0;i<args.length;i++)
{
sum=sum+Integer.parseInt(args[i]);
}
System.out.println(sum);
}
}
}

程序结果:aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOAAAABhCAIAAABAozrLAAADLklEQVR4nO3dy3HbMBRGYfaDetgP6mETaQINeJN1VtkyC5kSJYAgrHuv/Us533gyelCwM3MGpPiQprXr4/ff609/SSDC1H+aQPGz/sNAl3n6NC8//bfgjEOg03QyyMMy/eXHnx35vZVl3rIsOZGoPmugdSUPj1zu1v8e/kEHz351nLZSyu3OMk8pl+OFIcAU6HSsXrJ5u7nY6QKn4wwpOTGByvPZBu1Me3W4Rx134vvSOENKTsyer+D5QDvT50M0+7v1jaPHm9PwyDinvZactr+RKVSd5zZocwW9n+2ai9U172/XrzoapzlaxyVTplFx1m3Q641mZM2YmmHVrz36RYPjDCg5Eag60yp+HUhzbU1y9YNHC3eeMge62+cEVW476pvr1uZW6XMz6OA446t43ie9BLfdTA+P17c7c+rRa5uP98c5CfR2FInNz9fgeaizGetaRWNZxY+Pg/fguaP+aIHr7XVgHvUaB+/BcwYF3BEopBEopBEopBEopBEopNkDLTmx0xtRjIFuR2YIFDEcVvGcFIQ4BAppBAppBAppBAppBAppBAppDoEuM/tBEcVpRz076xGDY/GQRqCQRqCQRqCQRqCQRqCQRqCQRqCQ5hPo9pGwfFYcnNkDvRxMIk2E8DjUSZwIYwqUPBHNEujlNKa8nS9CqfBnCHSZp2lKKS/rur1NolE4Mwa6K5L1PQL4BVrdB+ys26C3IrnyAwFM7+L3XxjM/IkI1h31fPk6QnEsHtIIFNIIFNIIFNIIFNIIFNIIFNIIFNLcPpuJ/fSIYAm05PSZJSfbIYjlbKa8OzVkf1gecOO2DcrJIojgFWjJiT7hzynQkhPngiKAT6DLTJ4I4fMlCqzcEcQc6H7yLDlTKlzZAt1/hwJ76xHg+UC3DwyjTwTiWDykESikESikESikESikESikESikESik2QMtOdVfxc2lIPDhdE3SXaBcCgI3Pmcz3QXKpSDwExDoPS4FgUV0oFwKApPgQLkUBDaxgXIpCIzYDwppzwT6B/guBAppBAppBAppnoH+2nznfwDvzS1Q6kQEn0CpE0EcAqVOxGEGhTS2QSGNd/GQ9g+EMRfc68c9fQAAAABJRU5ErkJggg==" alt="" width="258" height="115" />