Not getting output


please tell the wrong approach i am applying, and how to correct the code

Modified Code

make cnt a global variable and print it in main()