I have code here which works as a countdown timer but it prints results on a new line like this:
10
9
8
7
6
5
4
3
2
1
here is my code:
int timer()
{
int count;
count = 10;
while(count != 0)
{
printf("Time: \t%d \n", count);
count--;
sleep(1);
}
printf("\nCount down timer has expired\n");
return 0;
}
what I've tried so far is to change \n to \r to print on a single line but it did not work. I'm trying to make it clear the line and print the next number in the line then clear that and print the next one if that makes sense