Nested While Loop के लिए, हमारे पास दो While Loops होते हैं।
पहला Loop Condition Check करता है और यदि Condition True है, तो यह Inner Loop यानी Nested Loop पर जाता है।
Loop 1
while (a < 25) { }Loop 2 (Loop1 के अंदर)
while (b < 45){ }Nested While Loop Create करने के लिए, निम्न Sample Code है।
Example
using System; namespace Program { class Demo { public static void Main(string[] args) { int a = 20; while (a < 25) { int b = 40; while (b < 45) { Console.Write("({0},{1}) ", a, b); b++; } a++; Console.WriteLine(); } } } }Output
(20,40) (20,41) (20,42) (20,43) (20,44) (21,40) (21,41) (21,42) (21,43) (21,44) (22,40) (22,41) (22,42) (22,43) (22,44) (23,40) (23,41) (23,42) (23,43) (23,44) (24,40) (24,41) (24,42) (24,43) (24,44)