Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let transactions=Number(input.shift());
- let totalSum=0;
- for(let i=0; i<transactions; i++){
- let sum=Number(input.shift());
- if(sum<0){
- console.log("Invalid operation!");
- break;
- }
- console.log(`Increase: ${sum.toFixed(2)}`);
- totalSum+=sum;
- }console.log(`Total: ${totalSum.toFixed(2)}`);
- }
Add Comment
Please, Sign In to add comment