#include <iostream>
#include <conio.h>
using namespace std;
main()
{
int a,b;
b=50;
cout<<"enter a value less than 50: ";
cin>>a;
do
{
cout<<"A number: "<<a<<endl;
a++;
Sleep(100);
}
while (a<=b);
getch();
return 0;
}

what does not work means?
It is very general term. Please say exactly what does not work. Errors, et al

You need to include Windows.h

next time post error! error like one below helps than "it doesn't work"
double for.cpp:16: error: 'sleep' was not declared in this scope