分类：教育/科学-理工学科-数学
问题：有一个分数序列:2/1,3/2,5/3,8/5,13/8,21/? 
快快点，急需帮助，先谢谢个位大大了，用解答
回答：
void main()
{
  int num, denom;    //定义分子和分母
  int a,b;
  double sum;    //和

  a = 2;      //定义初始值
  b = 1;

  sum = (double)a/b;

  for ( int i=1; i<24; i++ )
  {
    num = a + b;
    denom = a;

    sum = sum + (double)num/denom;

    a = num;
    b = denom;
  }
    
  //取小数点后两位
  sum = sum*100;
  sum = sum + 0.5;
  sum = (int)sum;
  sum = (double)sum/100;

  printf("the sum = %f\n",sum);
}