Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int percent = int.Parse(Console.ReadLine().Replace("%", ""));
- string command = Console.ReadLine().ToLower();
- int appsLeft = 0;
- while (command != "end")
- {
- // string[] input = command.Split(new Char[] { '_', '%' });
- if (percent > 15)
- {
- //int batteryConsumption = int.Parse(input[1]);
- int batteryConsumption = int.Parse(command.Substring(command.Length - 3, 2));
- percent -= batteryConsumption;
- }
- else if (percent <= 15 && percent > 0)
- {
- appsLeft++;
- }
- command = Console.ReadLine().ToLower();
- }
- if (percent <= 0)
- {
- Console.WriteLine("Phone Off");
- }
- else if (percent <= 15)
- {
- Console.WriteLine("Connect charger -> {0}%", percent);
- Console.WriteLine("Programs left -> {0}", appsLeft);
- }
- else
- {
- Console.WriteLine("Successful complete -> {0}%", percent);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement