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