Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Training_Cake_23_01_2019
- {
- class Program
- {
- static void Main(string[] args)
- {
- int l = int.Parse(Console.ReadLine());
- int w = int.Parse(Console.ReadLine());
- string comand = Console.ReadLine();
- int valueOfCake = l * w;
- int peeceCounter = 0;
- while (comand != "STOP")
- {
- peeceCounter += int.Parse(comand);
- if (peeceCounter > valueOfCake)
- {
- Console.WriteLine($"No more cake left! You need {peeceCounter - valueOfCake} pieces more.");
- break;
- }
- comand = Console.ReadLine();
- }
- if (comand == "STOP")
- {
- Console.WriteLine($"{valueOfCake - peeceCounter} pieces are left.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement