现在的位置: 首页 > 04 循环结构 > 正文

for 循环结构

2013年08月13日 04 循环结构 ⁄ 共 158字 ⁄ 字号 for 循环结构已关闭评论
1
2
3
4
5
6
7
8
9
10
11
// 2011_09_B_08
 
#include <stdio.h>
int main()
{
     int i, j;
     for(i=6; i>3; i--)
         j=i;
     printf("%d%d\n",i,j);
     return 0;
}

输出结果:34

1
2
3
4
5
6
7
8
9
10
11
12
13
// 2011_09_B_09
 
#include <stdio.h>
 int main()
 {
     int i,n[]= {0,0,0,0,0};
     for(i=1; i<=2; i++) {
         n[i]=n[i-1]*3+1;
         printf("%d",n[i]);
     }
     printf("\n");
     return 0;
 }

输出结果:14

【上篇】
【下篇】

抱歉!评论已关闭.