1,求数组各元素的和
package
array;
import
javax.swing.
*
;
//
计算数组元素之和

public
class
SumArray
...
{
public static void main(String args[])...{
int array[] = ...{1,2,3,4,5,6,7,8,9,10};
int total = 0;

for(int counter=0; counter<array.length;counter++)...{
total += array[counter];
JOptionPane.showMessageDialog(null, "Total of array elements:"+total,"Sum the Elements of an Arrays",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
}
2,

795

被折叠的 条评论
为什么被折叠?



