Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 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 ConsoleApp1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. //Input
  15. double breadPrice = double.Parse(Console.ReadLine());
  16. double breadCount = double.Parse(Console.ReadLine());
  17. double kozunaciCount = double.Parse(Console.ReadLine());
  18. double gevreciCount = double.Parse(Console.ReadLine());
  19. double kroasaniCount = double.Parse(Console.ReadLine());
  20.  
  21. double budget = double.Parse(Console.ReadLine());
  22.  
  23. //Calcs
  24. double kozunaciPrice = breadPrice * 1.2;
  25. double gevrekPrice = kozunaciPrice * 0.6;
  26. double kroasanPrice = gevrekPrice + 1.20;
  27.  
  28. double Total = breadPrice * breadCount + kozunaciPrice * kozunaciCount + gevrekPrice * gevreciCount + kroasanPrice * kroasaniCount;
  29.  
  30. if (Total <= budget)
  31. {
  32. Console.WriteLine($"Yes! {Math.Abs(Total - budget):F2} leva left.");
  33. }
  34. else
  35. {
  36. Console.WriteLine($"No! {Math.Abs(Total - budget):F2} leva need.");
  37. }
  38.  
  39.  
  40.  
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement