desislava777

voyage

Oct 30th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 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 ConsoleApplication25
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double a = double.Parse(Console.ReadLine());//а трябва да е от тип double а не int
  14. string b = Console.ReadLine();
  15. double c = 0;
  16. if (b == "winter")
  17. {
  18. if (a <= 100)
  19. {
  20. c = 70 * 0.01 * a;
  21. Console.WriteLine("Somewhere in Bulgaria");
  22. Console.WriteLine("Hotel - {0:f2}", c);
  23. }
  24. else if (a>100 && a <= 1000)//тук трябва да е така а не само else if(a<=1000), защото a<=100 се включва в изискването //а<=1000, а трябва двете изисквания да са противоположни, с други думи множеството от всички числа, които са <=100 е подмножество на //всички числа <=1000
  25. {
  26. c = 80 * 0.01 * a;
  27. Console.WriteLine("Somewhere in Balkans");
  28. Console.WriteLine("Hotel - {0:f2}", c);
  29. }
  30. else
  31. {
  32. c = 90 * 0.01 * a;
  33. Console.WriteLine("Somewhere in Europe");
  34. Console.WriteLine("Hotel - {0:f2}", c);
  35. }
  36. }
  37. if (b == "summer")
  38. {
  39. if (a <= 100)
  40. {
  41. c = 30 * 0.01 * a;
  42. Console.WriteLine("Somewhere in Bulgaria");
  43. Console.WriteLine("Camp - {0:f2}", c);
  44. }
  45. else if (a>100 && a <= 1000)//тук трябва да е така а не само else if(a<=1000)
  46. {
  47. c = 40 * 0.01 * a;
  48. Console.WriteLine("Somewhere in Balkans");
  49. Console.WriteLine("Camp - {0:f2}", c);
  50. }
  51. else
  52. {
  53. c = 90 * 0.01 * a;
  54. Console.WriteLine("Somewhere in Europe");
  55. Console.WriteLine("Hotel - {0:f2}", c);
  56. }
  57. }
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment