當前位置:編程學習大全網 - 電腦編程 - 用c語言編寫壹個程序。要求編寫壹個求2的n次方的函數實現。求滿足以下條件的最大的n。

用c語言編寫壹個程序。要求編寫壹個求2的n次方的函數實現。求滿足以下條件的最大的n。

#include <stdio.h>

#include <stdlib.h>

int main() {

int i=2;

int n=0;

int s=0;

for (;s+i<1000; i*=2, ++n)

s+=i;

printf("%d",n);

system("pause");

return 0;

}

  • 上一篇:tc腳本為什麽少人用
  • 下一篇:學3d建模需要素描知識嗎 知乎
  • copyright 2024編程學習大全網