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)
- {
- int guests = int.Parse(Console.ReadLine());
- int gifts = int.Parse(Console.ReadLine());
- string category = string.Empty;
- int catA = 0;
- int catB = 0;
- int catV = 0;
- int catG = 0;
- for (int i = 0; gifts <= guests && i <= gifts; i++)
- {
- 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.Truncate(catA / gifts * 100.00):F2}%");
- Console.WriteLine($"{Math.Truncate(catB / gifts * 100.00):F2}%");
- Console.WriteLine($"{Math.Truncate(catV / gifts * 100.00):F2}%");
- Console.WriteLine($"{Math.Truncate(catG / gifts * 100.00):F2}%");
- Console.WriteLine($"{Math.Truncate(gifts / guests * 100.00):F2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment