Advertisement
Guest User

Untitled

a guest
May 12th, 2016
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _04UmnataLili
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. byte age = byte.Parse(Console.ReadLine());
  14. double washingMachines = double.Parse(Console.ReadLine());
  15. int priceGames = int.Parse(Console.ReadLine());
  16. int evenCount = 0;
  17. int oddCount = 0;
  18. int sum = 0;
  19. int sum1 = 0;
  20. int endSum = 0;
  21. for (int i = 1; i <= age; i++)
  22. {
  23. if (i % 2 == 0)
  24. {
  25. sum += 10;
  26. evenCount++;
  27. sum1 += sum;
  28. }
  29. else
  30. {
  31. oddCount++;
  32. }
  33.  
  34. }
  35. endSum = (sum1 - evenCount) + (oddCount * priceGames);
  36.  
  37. if (endSum >= washingMachines)
  38. {
  39. Console.WriteLine("Yes! {0:F2}",(endSum - washingMachines));
  40. }
  41. else
  42. {
  43. Console.WriteLine("No! {0:F2}",(washingMachines - endSum));
  44. }
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement