例如:2+22+222+2222+22222

#include<stdio.h>
int main()
{
	int a, n;
	int i, sum = 0,tmp=0;
	printf("请输入需要的个数和数值:\n");
	scanf("%d%d",&n,&a);
	for (i = 0; i < n; i++)
	{
		tmp = tmp * 10 + a;
		sum = sum + tmp;
	}
	printf("%d\n",sum);
	return 0;
}