how I can substract value from balance when i input value.
when i add value , it will be added to balance.
please see like example below:
https://imgur.com/a/9EeviDi

You need to provide more info. Is this a form you're submitting to the server to calculate or do you want all this to happen in the browser? Have you tried anything yourself?

I want to calculate for debit credit from balance .
For first entry, when i insert credit value, it will be added in balance.
again, when i insert debit value, it will be subtracted from previous balance.Thus it will be continue
like example below:
https://imgur.com/a/xVT5Ba3