title: How to print integers in typing order in C - increasing, decreasing or evenly
body: <p>I have a problem with a c program I'm trying to write. The program must store integers in array (read from the keyboard). The numbers must be printed out in the order of entering, for example if you enter: 3 2 0 5 5 5 8 9, the ouput should be:</p>
  
  <p>3 2 0 - decreasing
  5 5 5 - evenly
  8 9 - increasing</p>
  
  <p>The problem for me is, that I can't write an algorithm which to be able to work in all cases.
  I was trying to "flag" the elements with another array(using the same index, to save for each integer a value 1-for increasing, -1-for decreasing and 0 for evenly), but this works partly.
  Have you any other ideas?
  Thanks in advance :)</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  main() {
  
      int array[100];
      int flag[100];
      int num, i;
  
      printf("Enter how many numbers you want to type: ");
      scanf("%d",&amp;num);
  
      for(i=0;i&lt;num;i++) {
          scanf("%d",&amp;array[i]);
      }
      for(i=0;i&lt;num;i++){
          if((array[i]&lt;array[i+1])) {
              flag[i]=flag[i+1]=1;
          }
          if(array[i]&gt;array[i+1]) {
              flag[i]=flag[i+1]=-1;
          }
      }
  
      for(i=0;i&lt;num;i++) {
          if(array[i]==array[i+1]) {
              flag[i]=flag[i+1]=0;
          }
      }
      for(i=0;i&lt;num;i++){
          printf("%d ",flag[i]);
      } 
      printf("\n");
  
      for(i=0;i&lt;num;i++) {
          if(flag[i]==1) {
              do{
                  if(flag[i]==1){
                      printf("%d ",array[i]);
                      i++;
                  }
              }while(flag[i]==1);
              printf(" - increasing\n");
          }
  
          if(flag[i]==0) {
              do{
                  if(flag[i]==0){
                      printf("%d ",array[i]);
                      i++;
                  }
              }while(flag[i]==0);
              printf(" - evenly\n");
          }
  
          if(flag[i]==-1) {
              do{
                  if(flag[i]==-1) {
                      printf("%d ",array[i]);
                      i++;
                  }
              }while(flag[i]==-1);
              printf(" - decreasing\n");
          }
  
      } 
  
      system("pause");
      return 0;
  }
  </code></pre>