การบ้าน java แบบฝึกหัดที่ 4.3

วันพฤหัสบดีที่ 17 ธันวาคม พ.ศ. 2552
เขียนโปรแกรมคำนวนหาผลบวกของอนุกรมต่อไปนี่
sum = 1.0/1+1.0/2+1.0/3+1.0/4+...1.0/n








private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int n = Integer.parseInt(tfInput.getText());
double b = 1.0;
double sum = 0;

for (int i = 1; i <= n; i++) {
sum += b / i;


lblResult.setText(String.valueOf(sum));

}

1 ความคิดเห็น:

hanahabecker กล่าวว่า...

ecm titanium, ct-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t
Ecm titanium titanium grey is a material with titanium bmx frame excellent yield of 60,000 times the atmospheric CO 2 and is the titanium nipple jewelry primary titanium post earrings component in titanium sia soils. This material has a depth of $2.49 · ‎In stock

แสดงความคิดเห็น