2.7

#include<stdio.h>

#include<math.h>

int main(void)

{

         int i,n,y;

         double power;

         printf("Enter n:");

         scanf("%d",&n);

 

         for(i=0;i<=n;i++){

                   power=pow(2,i);

                   y=y+power;

                   printf("%d",y);

         }

         return 0;

}

posted @ 2013-10-19 22:50  zhaoyang16  阅读(130)  评论(0编辑  收藏  举报