The syntax of a while loop is as follows:
\begin{verbatim}
while (condition)
{
// code block to be executed
}
\end{verbatim}
The condition is evaluated, and if the condition is true, the code inside the loop is executed. This repeats until the condition
Show more…