OMP Critical C Solution

#include 
#include 

int main(){
   int c=0, iam, i, num_threads;

#pragma omp parallel private(iam)
 {
   iam = omp_get_thread_num();
   num_threads = omp_get_num_threads();

#pragma omp critical
  {
     for(i=1; i<1000; i++){
       if(i == 1) c += iam;
       else c = c;
     }
  }
#pragma omp barrier
#pragma omp for ordered schedule(dynamic)
     for(iam=0; iam