DPI-C in SystemVerilog Testbench (Output of C Model is not matching with SV output)

In reply to dave_59:

Thanks a lot, Due to your valuable suggestions, I’ve been able to do it correctly.

This is the correct output achieved for reference.