Advertisement
Monteso

Untitled

Oct 13th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Cake
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int a = int.Parse(Console.ReadLine());
  10.             int b = int.Parse(Console.ReadLine());
  11.             int pieces = a * b;
  12.            
  13.             for (int i = 0; i < pieces; i++)
  14.             {
  15.                 int num = int.Parse(Console.ReadLine());
  16.                 pieces -= num;
  17.             }
  18.  
  19.             string pieces2 = pieces.ToString();
  20.             var stop = Console.ReadLine().ToLower();
  21.             // i s dvata varianta ne stava
  22.             if (pieces2 == "stop")
  23.             { Console.WriteLine("{0} pieces are left.", pieces); }
  24.             else if (pieces < 0)
  25.             { Console.WriteLine($"No more cake left! You need {Math.Abs(pieces)} pieces more."); }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement