fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a=1, n=0;
  5. do
  6. {
  7. printf("2^%d = %d\n", n, a);
  8. a=a*2;
  9. n = n + 1;
  10. }
  11. while( a<=10000 );
  12. printf("2の %d 乗で初めて10000を超えます\n", n);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64
2^7 = 128
2^8 = 256
2^9 = 512
2^10 = 1024
2^11 = 2048
2^12 = 4096
2^13 = 8192
2の 14 乗で初めて10000を超えます