Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp43
- {
- class Program
- {
- static void Main(string[] args)
- {
- int seaPacketNum = int.Parse(Console.ReadLine());
- int mountainPacketNum = int.Parse(Console.ReadLine());
- string destination = Console.ReadLine();
- int profit = 0;
- int seaPrice = 680;
- int mountainPrice = 499;
- string choice = " ";
- while (destination != "Stop")
- {
- choice = destination;
- if (destination == "sea")
- {
- if (seaPacketNum > 0)
- {
- seaPacketNum--;
- profit += seaPrice;
- }
- }
- else if (destination == "mountain")
- {
- if (mountainPacketNum > 0)
- {
- mountainPacketNum--;
- profit += mountainPrice;
- }
- }
- if (seaPacketNum == 0 && mountainPacketNum == 0)
- {
- break;
- }
- destination = Console.ReadLine();
- }
- if (seaPacketNum == 0 && mountainPacketNum == 0)
- {
- Console.WriteLine("Good job! Everything is sold.");
- }
- Console.WriteLine($"Profit: {profit} leva.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement