fork download
  1. #include <stdio.h>
  2.  
  3. int main(){
  4. //a0=2 ←初項
  5. //「break;」は、ループやswitch文の実行を途中で終了させる
  6. //「return 0;」は、関数からの戻り値として、整数値0を返す
  7. int a;
  8. for (a = 2; a < 1000;a = 3 * a - 2) {
  9. //&& かつ ||または
  10. if ((100 <= a) && (a <= 1000)) {
  11. printf("%d\n", a);
  12. //ここで改行しないと244730となってしまう
  13. }
  14. }
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
244
730