Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99323
  • 博文数量: 102
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1011
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-15 13:58
个人简介

普普通通一个人

文章分类

全部博文(102)

文章存档

2018年(1)

2015年(13)

2014年(88)

我的朋友

分类: C/C++

2014-01-21 16:24:48


点击(此处)折叠或打开

  1. #include <stdio.h>

  2. int main(){
  3.     /* declaration the variable */
  4.     int i_end;                      /* critical point */
  5.     int x = 0, y = 1, z = 0;        /* initialize the tmp variable */

  6.     /* prompt */
  7.     printf("%s", "Enter the end number: ");
  8.     scanf("%d", &i_end);

  9.     /* Loop output the result */
  10.     while ( ( y + z ) < i_end ){     /* in advance make new third number + the second */
  11.         x = y;                       /* second number -> first number */
  12.         y = z;                       /* third number -> second number */
  13.         z = x + y;                   /* first + second = new third */
  14.         printf("%d ", z);
  15.     }

  16.     return 0;
  17. }

阅读(131) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~