While loops are used to execute a block of code again and again until a specified condition is true.
In while loop at first initialisation is done. In initialisation we assign any value to a variable.
Syntax of while loop
while(condition)
{
block of code
}
Example :-
Output of the above code
No comments:
Post a Comment