File size: 577 Bytes
497f2f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace ConsoleApplication1
{
    using System;
    class Program
    {
        static void Main(string[] args)
        {
            //Perform the operation.
            bool[] doors = new bool[100];
            int n = 0;
            int d;
            while ((d = (++n * n)) <= 100)
                doors[d - 1] = true;

            //Perform the presentation.
            for (d = 0; d < doors.Length; d++)
                Console.WriteLine("Door #{0}: {1}", d + 1, doors[d] ? "Open" : "Closed");
            Console.ReadKey(true);
        }
    }
}