PavelIvanov

Untitled

May 26th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. function solve(input) {
  2. let transactions=Number(input.shift());
  3. let totalSum=0;
  4. for(let i=0; i<transactions; i++){
  5. let sum=Number(input.shift());
  6. if(sum<0){
  7. console.log("Invalid operation!");
  8. break;
  9. }
  10. console.log(`Increase: ${sum.toFixed(2)}`);
  11. totalSum+=sum;
  12.  
  13. }console.log(`Total: ${totalSum.toFixed(2)}`);
  14.  
  15. }
Add Comment
Please, Sign In to add comment