using System; using System.Collections; using System.Collections.Generic; class Example { public static void Main() { Dictionary d = new Dictionary(); d.Add("1а",20); d.Add("1б",21); d.Add("2а",15); d.Add("2б",33); d.Add("3а",23); d.Add("3б",31); d.Add("4а",25); d.Add("4б",32); foreach (KeyValuePair p in d) Console.Write(p.Key+":"+Convert.ToString(p.Value)+" "); Console.WriteLine(); d["1а"]+=1; d["1б"]-=1; d["2а"]+=2; d["2б"]-=2; d["3а"]+=3; d["3б"]-=3; d["4а"]+=4; d["4б"]-=4; int s=0; foreach (KeyValuePair p in d) { Console.Write(p.Key+":"+Convert.ToString(p.Value)+" "); s+=p.Value; } Console.WriteLine("\nКількість учнів у всіх класах: "+s); } }