Hey, I'm building a small program.
This is just the first part, which tries to scan for a multi-digit number and put it in some variable.
Problem is, for some reason, it wouldn't calculate simple things (sometimes even doing 10^3, 10^1 and 10^0 just fine, but giving 99 as a result of 10^2. Yes, "wtf" did come to mind at this point).

Is this a problem with the code or it is my computer trying to annoy it's wretched master?
Help would be REALLY appreciated.
Here's the code:
Code:
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
int y=1,ss=0,fatty;
char ch=0;
char num[4]={{0,0,0,0}};
char number=0;
int tester;

printf("Enter your number. When you're done, press esc.");

while (y<2)
{

    ch=getch();
    if (ch==27)
       y = 2;
    else
    {
        if (ch > 47 && ch < 58)
        {
               
            ch = ch - 48;
            printf("%d\n",ch);
            num[ss]=ch;
            ss++;
        }
    }

}
ss--;

for ( fatty = 0 ; fatty <= ss ; fatty++ )
{
    tester = pow(10,ss-fatty);
    printf("\n%d,%d,%d,%d",ss,ss-fatty,num[ss-fatty],pow(10,num[ss-fatty]));

    getch();
    number = number + num[ss-fatty] * pow(10,num[ss-fatty]) ;
    printf("\n%lf",number);
}

printf("Your number is: %lf",number);
getch();


}
This version is closer to working, though it uses %d when trying to printf a double variable, instead of %lf (which I think is correct).

Code:
#include <stdio.h>
#include <conio.h>
#include <math.h>

void main()
{
int y=1,ss=0,fatty;
char ch=0;
char num[4]={{0,0,0,0}};
char number=0;
int tester;

printf("Enter your number. When you're done, press esc.");

while (y<2)
{

    ch=getch();
    if (ch==27)
       y = 2;
    else
    {
    ch = ch - 48;
    printf("%d\n",ch);
    num[ss]=ch;
    ss++;
    }

}
ss--;

for ( fatty = 0 ; fatty <= ss ; fatty++ )
{
    tester = pow(10,ss-fatty);
    printf("%d,%d,%d,%d",ss,ss-fatty,num[ss-fatty],tester);

    getch();
    number = number + num[ss-fatty] * tester ;
    printf("\n%d",number);
}

printf("Your number is: %lf",number);
getch();


}