Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Exam_Wedding_Presents
- {
- class Program
- {
- static void Main(string[] args)
- {
- double guests = double.Parse(Console.ReadLine());
- double gifts = double.Parse(Console.ReadLine());
- double catA = 0;
- double catB = 0;
- double catV = 0;
- double catG = 0;
- for (int i = 0; gifts <= guests && i <= gifts; i++)
- {
- string category = string.Empty;
- switch (category)
- {
- case "A": catA += catA; gifts--; break;
- case "B": catB += catB; gifts--; break;
- case "V": catV += catV; gifts--; break;
- case "G": catG += catG; gifts--; break;
- }
- }
- Console.WriteLine($"{Math.Round(catA / gifts * 100.0):F2}%");
- Console.WriteLine($"{Math.Round(catB / gifts * 100.0):F2}%");
- Console.WriteLine($"{Math.Round(catV / gifts * 100.0):F2}%");
- Console.WriteLine($"{Math.Round(catG / gifts * 100.0):F2}%");
- Console.WriteLine($"{Math.Round(gifts / guests * 100.0):F2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment