{}
CODE VISUALIZER
Learn DSA the way it should be — with step-by-step code visualization.
Try now!
CODE VISUALIZER
Learn DSA with step-by-step code visualization.
Try now!
run-icon
Main.cs
// Online C# Editor for free // Write, Edit and Run your C# code using C# Online Compiler using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; public class HelloWorld { public static void Main(string[] args) { Dictionary<string, int> ageDictionary = new Dictionary<string, int>(); string stopWord = "exit"; do { Console.WriteLine("Введите имя:"); string name = Console.ReadLine(); Console.WriteLine("Введите возраст:"); int age = Convert.ToInt32(Console.ReadLine()); ageDictionary.Add(name, age); } while (Console.ReadLine() != stopWord); foreach (var pair in ageDictionary) { Console.WriteLine($"Имя: {pair.Key}, Возраст: {pair.Value}"); } } }
Output