Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Cake
- {
- class Program
- {
- static void Main(string[] args)
- {
- int length = int.Parse(Console.ReadLine());
- int width = int.Parse(Console.ReadLine());
- int cakePeaces = length * width;
- while (cakePeaces > 0)
- {
- string input = Console.ReadLine();
- if (input == "STOP")
- {
- break;
- }
- int peaceOfCake = int.Parse(input);
- cakePeaces -= peaceOfCake;
- }
- if (cakePeaces >= 0)
- {
- Console.WriteLine($"{cakePeaces} pieces are left.");
- }
- else
- {
- Console.WriteLine($"No more cake left! You need {Math.Abs(cakePeaces)} pieces more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement