Advertisement
tmollov

Untitled

Feb 27th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace simpleArrays
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. List<double> mAh = Console.ReadLine().Split().Select(double.Parse).ToList();
  13. List<double> mili = Console.ReadLine().Split().Select(double.Parse).ToList();
  14. int hours = int.Parse(Console.ReadLine());
  15.  
  16. for (int i = 0; i < mAh.Count; i++)
  17. {
  18. double used = mili[i] * hours;
  19. double left = mAh[i] - used;
  20. double procent = left / (mAh[i] / 100.0);
  21.  
  22. if (left >= 0)
  23. {
  24. Console.WriteLine("Battery {0}: {1:f2} mAh ({2:f2})%",i+1,left,procent);
  25. }
  26. else
  27. {
  28. int dead = (int)(mAh[i] / mili[i]) + 1;
  29. Console.WriteLine("Battery {0}: dead (lasted {1} hours)",i+1,dead);
  30. }
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement