Q:

global variables value changes automatically?

...

char A,M,Q,Q_1,count;

int main()

{

    system("cls");
    count=8;
    printf("%d",count);
    printf("\n\tEnter the Multiplicand(M) : ");
    scanf("%d",&M);
    printf("\n\tEnter the Multiplier(Q) : ");
    scanf("%d",&Q);
        printf("%d",count);    //prints 0???????
.......

}

I don't understand how the value of 'count' changes to 0.
plz help...
thanks.
System : win7/VS2008
EDIT:
After having an insight on what I was doing(thanks to Péter Török ),I moved the assignment to 'count' after scanfs,this solved the problem...thanks. 

A:

Since you attempt to read an integer (%d) with scanf and store it in a char variable, there is a memory overflow: a char is 1 byte while an int is (usually) 4. The result is that the memory area after the variables M, and then Q, gets overwritten. And this happens to affect count too.
Declare your variables as int to avoid this (or explicitly read char values with scanf - but if you want to multiply values, it is better to start with ints right away, to at least mitigate the risk of integer overflow).

A:

Don't lie to the compiler.
You first said M is a char
char A,M,...

and then tried to use it as an int
scanf("%d",&M);

Don't do that!
Either declare M (and the other variables) as int, or scanf a char

