   std::cout << "\nA matrix \n";
   for (int i=0; i<N; i++){
     for (int j=0; j<M; j++){
-      std::cout << h_a[j*M+i] << " ";
+      std::cout << h_a[j*N+i] << " ";
     }
     std::cout << "\n";
   }

  std::cout << "\nB matrix \n";
  for (int i=0; i<M; i++){
    for (int j=0; j<K; j++){
      std::cout << h_b[j*K+i] << " ";
    }
    std::cout << "\n";
  }

  int Col = blockIdx.x*blockDim.x+threadIdx.x;
  if ((Row < n) && (Col < k)) {
    float Cvalue = 0.0;
    for (int i = 0; i < m; ++i)  Cvalue += A[Row*n+i] * B[Col+i*m];
    C[Row*k+Col] = Cvalue;
  }
}

