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