What kind of error is it? Syntax, stack, overflow, illegal arguments? What compiler are you using? I personally recommend Codeblocks and Turbo C. What file is that? That doesn't look like your code. That looks like low-level header code. Linker error. You're using a function that doesn't exist.
I compiled the code for Real-Time, medium model, speed priority, using Turbo C. It's not scan(). It's scanf(). I have the compiled program if you want me to pass it. (Since I compiled for Real-Time, it will NOT work on x64 systems without a DOS emulator.)
Other than that, it works as you stated it should.
#include <stdio.h>
#include <stdlib.h>
void main() {
int n, star;
printf("Enter n");
scanf("%d", &n);
while (n > 0)
{
printf("\n%d", n % 10);
star = n % 10;
while (star > 0)
{
printf("*");
star--;
}
printf("n%d\n");
n /= 10;
}
}
Except that the output is the following:
Enter n1234
4****n1224
3***n1224
2**n1224
1*n1224
Quick edit, no matter what I input, the print is always *n1224.

Also, numbers with more than 4 digits causes the program to quit.
l8 edit: Also, avoid doing that C++ bullstuff. If your function doesn't need to return anything, use
void or nothing at all. Not
int functionname and then
return 0;