While loop is the simplest loop of C++ language. This loopexecutes one or more statement while the given condition remains true. It is useful when the number of iterations is not known in advance.
while(condition) { Statement; Statement; }
#includevoid main() { int i=1; while ( i < 5 ) { cout<<"This Is No\n"<< i ; i = i++; } }
output:-
This Is No 1
This Is No 2
This Is No 3
This Is No 4
This Is No 5