Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- string command = Console.ReadLine();
- int counterOfKids = 0;
- int counterOfAdults = 0;
- double moneyForToys = 0; //for kids
- double moneyForSweaters = 0; //for adult
- while(command != "Christmas")
- {
- int age = int.Parse(command);
- if(age <= 16)
- {
- counterOfKids++;
- moneyForToys += 5;
- }
- else
- {
- counterOfAdults++;
- moneyForSweaters += 15;
- }
- command = Console.ReadLine();
- }
- Console.WriteLine("Number of adults: {0}", counterOfAdults);
- Console.WriteLine("Number of kids: {0}", counterOfKids);
- Console.WriteLine("Money for toys: {0}", moneyForToys);
- Console.WriteLine("Money for sweaters: {0}", moneyForSweaters);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement