fork download
  1. #include<stdio.h>
  2. int main(void){
  3. int a[]={1,0,1,1,1,0,0,1,0,1, 1};
  4. int n = 11,
  5. i,
  6. index = 0;
  7. while(a[index]) index++;
  8. for(i = index; i < n; i++){
  9. if(a[i]) a[index++] = 1;
  10. a[i] = 0;
  11. }
  12. for(i = 0; i < n; i++){
  13. printf("%3d", a[i]);
  14. }
  15. return 1;
  16. }
Runtime error #stdin #stdout 0s 1788KB
stdin
Standard input is empty
stdout
  1  1  1  1  1  1  1  0  0  0  0