this post is show u how to use C++ Code while loop

#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main()
{
    int i;
    cout<<”Enter the number”;
    cin>>i;
    cout<<i;
    while (i!=1)
    {
          if (i%2==0)
          {i/=2;}
          else {
          i=i*3+1;
          cout<<setw(7)<<i;}
          }

cout <<endl;
system (“pause”);
return 0;
}

#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main()
{
    int i;
    cout<<”Enter the number”;
    cin>>i;
    cout<<i;
    while (i!=1)
    {
          if (i%2==0)
          {i/=2;}
          else {
          i=i*3+1;
          cout<<setw(7)<<i;}
          }

cout <<endl;
system (“pause”);
return 0;
}