• How while loop works?
  1. The while loop evaluates the test expression.
  2. If the test expression is true, codes inside the body of while loop is evaluated.
  3. Then, the test expression is evaluated again. This process goes on until the test expression is false.
  4. When the test expression is false, while loop is terminated.

  • Flowchart of while Loop.

Flowchart of while loop in C++ Programming

  • prog to print valuve from 1 to 10 using while loop:-

#include<iostream.h>
void main()
{
int k;
k=1;
while(k<=10)
{
cout<<k<<endl;
k++;
}
}
note:-it's just a sudo code if its not executing on your device make some changes in the further code this is only for understanding logic.

thankyou for visiting us stay tuned for learning and more intresting u can ask questions in comment section check other blogs for more info. comment mail for compitative cading thankyou.👍😎🙏