Table of Contents
In this tutorial, we will discuss the Nested while in C programming language.
initially, the outer while evaluates the test Expression
When the condition is true, it executes the body of statements of the outer loop and the loop control move to the inner loop and statements inside the body of the inner loop is executed.This process repeats until the test expression of the inner while loop is false.
Then, when the test expression of the inner while loop is false. control exits from the inner loop and moves to outer loop again
then the loop-control evaluates the test condition of the outer while loop
The test condition of outer loop returns true, the loop control executes the body of while loop statements and move to the inner loop
Outer while loop return as false the loop control exit from the loop and goes to rest
Here we can see a while loop inside the body of another while loop.
Program 1
Output
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
Program 2
Output
1 2 3 4 5 6 7 8 9
2 4 6 8 10 12 14 16 18
3 6 9 12 15 18 21 24 27
4 8 12 16 20 24 28 32 36
5 10 15 20 25 30 35 40 45
6 12 18 24 30 36 42 48 54
7 14 21 28 35 42 49 56 63
8 16 24 32 40 48 56 64 72
9 18 27 36 45 54 63 72 81
Prpgram 3
Print a multiplication table using nested while loop
Subtract two numbers using method overriding Program 1
PHP Star triangle Pattern program Here's a simple Java program that demonstrates how to print…
Using Function or Method to Write to temperature conversion: Fahrenheit into Celsius In this article,…
Function or method of temperature conversion from Fahrenheit into Celsius In this article, we will…
Write temperature conversion program: from Fahrenheit to Celsius In this article, we will discuss the…
How to write a program to convert Fahrenheit into Celsius In this article, we will…
This website uses cookies.