Advertisement
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 ConsoleApplication1
- {
- class Program
- {
- static void Main()
- {
- var kapacitet = int.Parse(Console.ReadLine());
- var broiFenove = int.Parse(Console.ReadLine());
- var a = 0.0;
- var b = 0.0;
- var v = 0.0;
- var g = 0.0;
- //var sum = 0.0;
- for (int i = 1; i <= broiFenove; i++)
- {
- var sektor = Console.ReadLine().ToLower();
- if (sektor == "a")
- {
- a += 1;
- }
- if (sektor == "b")
- {
- b += 1;
- }
- if (sektor == "v")
- {
- v += 1;
- }
- if (sektor == "g")
- {
- g += 1;
- }
- }
- var procentA = (a / broiFenove) * 100.0;
- var procentB = (b / broiFenove) * 100.0;
- var procentV = (v / broiFenove) * 100.0;
- var procentG = (g / broiFenove) * 100.0;
- var obshtProcent = ((double)broiFenove / kapacitet) * 100.0;
- Console.WriteLine($"{procentA:f2}%");
- Console.WriteLine($"{procentB:f2}%");
- Console.WriteLine($"{procentV:f2}%");
- Console.WriteLine($"{procentG:f2}%");
- Console.WriteLine($"{obshtProcent:f2}%");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement