whats wrong in this c to cuda conversion?

I have a doc attached which contains the C code and its corresponding CUDA code but this doesnt seem to work for me
Can anyone have a look and tell where the problem is?

Thanks in advance!!!
Sample.cpp (5.05 KB)