Loading...
Loading...
Loading...
A bank statement lists n UPI entries. A positive amount is money received (a credit), a negative amount is money sent (a debit), and 0 is a failed payment. Count each kind.
Credits: a, Debits: b, Failed: c.Example
Input
6 500 -200 0 1200 -50 0
Output
Credits: 2 Debits: 2 Failed: 2
500 and 1200 are credits, -200 and -50 are debits, two entries are 0.
Try the problem first. Open one hint at a time.
Keep three counters and use if, else if, else to decide which one to increase.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor