See if this works for you. I got rid of the do while loop and made the variable names a bit clearer.

Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
    srand(time(NULL));
    int numToGuess = rand()%10;
    int guessCount, isGuessRight, currentGuess;


    isGuessRight = 0;
    guessCount = 0;


    while(!isGuessRight)
    {
        printf(" Enter a number.\n");
        scanf("%d",&currentGuess);


        if(currentGuess < numToGuess)
            printf("Enter a bigger number.\n");
        else if(currentGuess > numToGuess)
            printf("Enter a smaller number.\n");
        else
        {
            printf("Congrats you won.\n");
            isGuessRight = 1;
        }


        guessCount++;
    }


    printf("You had to guess %d times to win!\n", guessCount);
    system("pause");


    return 0;
}