Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Computer_Store
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- double totalPrice = 0;
- do {
- string input = Console.ReadLine();
- if (input == "special" || input == "regular")
- {
- break;
- }
- double price = 0;
- bool valid = double.TryParse(input, out price);
- if (!valid || price <= 0)
- {
- Console.WriteLine("Invalid price!");
- continue;
- }
- totalPrice += price;
- } while (true);
- Console.WriteLine(totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement