fork download
  1. #include <stdio.h>
  2. int a[105], n;
  3.  
  4. void Try(int pos){
  5. if(pos == 0){
  6. return;
  7. }
  8. else{
  9. printf("[");
  10. for(int i = 0; i<pos; i++){
  11. printf("%d ", a[i]);
  12. }
  13. printf("]");
  14. printf("\n");
  15.  
  16. for(int i = 0; i< pos; i++){
  17. a[i] = a[i] + a[i+1];
  18. }
  19. Try(pos -1);
  20. }
  21. }
  22.  
  23. int main(){
  24. scanf("%d",&n);
  25. for(int i = 0; i<n; i++){
  26. scanf("%d", &a[i]);
  27. }
  28.  
  29. Try(n);
  30. }
  31.  
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
Standard output is empty