using System; public class Test { public static void Main() { int count = 0; string num; for (int i = 2; i < 1000000; i++) { num = i.ToString(); if (num.Contains("2")) { count++; } } Console.WriteLine(count); } }
Standard input is empty
468559
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!