While Loop

Source

#include <iostream>
using namespace std;

int main()
{
   int x = 0;

   while (x < 10)
   {
      cout << "x: " << x << endl;
      x++;
   } 

  return 0;
}

Output


x: 0
x: 1
x: 2
x: 3
x: 4
x: 5
x: 6
x: 7
x: 8
x: 9