fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int a=1, sum=0;
  5. while(sum<1000)
  6. {
  7. sum = sum + a;
  8. a += 1;
  9. }
  10. printf("和が1000を超えるのは%dを足した直後である",a-1);
  11.  
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
和が1000を超えるのは45を足した直後である