码迷,mamicode.com
首页 > 其他好文 > 详细

C primer 第六章习题6.13

时间:2017-05-17 17:29:06      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:for循环   循环   类型   stdio.h   习题   std   void   clu   数组   

//编写程序包含8个元素的int类型数组,用for循环设置数组元素,用do while循环显示元素值。

#include <stdio.h>
int main(void)
{
       int num[8],index,i,pow;

         for (index=0,i=0,pow=1;index<=7;index++){
                pow*=2;
                num[index]=pow;
            do    {
            i++;
            printf("%d ",num[index]);
            } while (i<=index);
        }

     return 0;
}

C primer 第六章习题6.13

标签:for循环   循环   类型   stdio.h   习题   std   void   clu   数组   

原文地址:http://www.cnblogs.com/lee1994/p/6867939.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!