首页 > 其他分享 >task3.c

task3.c

时间:2022-10-15 12:24:42浏览次数:37  
标签:task3 int scanf while printf main

#include<stdio.h>
int main(){
    int n ;
printf("n=");
    scanf_s("%lld", &n);
    int sum = 0, i = 0, t = 1;
    
    while (i <= n) {
        sum += t;
        t *= 2;
        i++;
    }
    printf("sum=%lld\n", sum);
}

 

标签:task3,int,scanf,while,printf,main
From: https://www.cnblogs.com/liangchenxi/p/16793885.html

相关文章