#include <stdio.h>
int mypow(int x, int y);
int main(void)
{
int i, j ;
int val, midval;
for (i = 1; i < 10; i ++)
{
val = 0;
midval = 0;
for (j = 0; j < 9; j ++)
{
midval += i * mypow(10, j);
//printf("\tmidval = %d\n", midval);
val += midval;
}
printf("val = %d\n", val);
}
}
int mypow(int x, int y)
{
int val = 1;
while(y)
{
val *= x;
y --;
}
return val;
}
难道溢出了,没有仔细想