描述
給定非負整數n,求2n。
輸入一個整數n。0 <= n < 31。輸出一個整數,即2的n次方。樣例輸入
3
樣例輸出
8
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int a,i; 6 long long int x; 7 scanf("%d",&a); 8 x=1; 9 for(i=1;i<=a;i++) 10 x=x*2; 11 printf("%lld\n",x); 12 return 0; 13 }
描述
給定非負整數n,求2n。
輸入一個整數n。0 <= n < 31。輸出一個整數,即2的n次方。樣例輸入
3
樣例輸出
8
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int a,i; 6 long long int x; 7 scanf("%d",&a); 8 x=1; 9 for(i=1;i<=a;i++) 10 x=x*2; 11 printf("%lld\n",x); 12 return 0; 13 }
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。