My code is passing oly one test case , can i have sol for the program with explanation

Sry check this https://ide.codingblocks.com/s/305336

Your logic is correct,Just change int to long long int.I have edited your code and it is working fine.
If you think your doubt has been resolved then please marks this as resolved and give your feedback.
Thanks:)