Using OMP ORDERED to order output from OpenMP threads

This exercise presents a simple program to demonstrate the use of OMP ORDERED. Compile and run the code provided below. What happens if you remove the "#pragma omp ordered" line?

 

#include < stdio.h>

void  work(int k){
#pragma omp ordered
  {
     printf("%d
", k);
  }
}

main(){
    int i;
#pragma omp parallel for ordered schedule(dynamic)
    for(i=1; i<=4; i++){
       work(i);
    }
}