统计信息

  • 访问数:11140
  • 博客数:142
  • 建立时间:2008-01-05
  • 更新时间:2008-05-21
我叫王超然,是一名电脑爱好者,现在在新加坡留学上高一.我立志成为一名电脑人才,愿意在这里与大家一同分享我玩转电脑的心得.O-level华文考了A-One哈哈!

P5Q12

2008-04-09 09:20:08

天气: 晴朗 心情: 高兴

/*fileName:P5Q12.java
*Name:Wang Chaoran
* Description:
12 (Computing series)
Write a method to compute the following series:
*/
import java.util.Scanner;
public class P5Q12{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    System.out.println("Please enter an integer");
    int i = scan.nextInt();
    System.out.println("m(i)="+ m(i));
  }
  public static double m(int i){
    double sum = 0;
    for(double j=1;j<=i;j++){
    sum += j/(j+1);
    }
    return sum;
  }
}

加入收藏 编辑 审核

TAG: computing

我来说两句

OPEN

Powered by X-Space 1.2 © 2001-2006 Comsenz Technology Ltd