  
|
[隨堂測驗] 計算 2 的 16 次方
本帖最後由 李泳霖 於 2024-1-23 11:38 編輯
試利用 for 迴圈,計算 2 的 16 次方的值。
 - #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int res=1; //result
- for(int i=1; i<=16; i++)
- res*=2;
- cout<<"2的16次方: "<<res<<endl;
- system("pause");
- return 0;
- }
複製代碼 |
|