using System; using System.Collections; using System.Collections.Generic; class Example { public static void Main() { Random r = new Random(); List l = new List(5); for (int j=0; j<5; j++) { l.Add(r.Next(20)); Console.Write("{0} ",l[j]); } int s=0; for (int j = 0; j < l.Count; j++) { int b=l[j]; while (b > 0) { s += b%10; b = (b-b%10)/10; } } Console.WriteLine("\nШукана сума цифр: {0} ",s); } }