#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>//统计从输入的两个整数a和b所确定的范围内(0 ~ 9)出现的次数
int main()
{//创建两个变量输入范围int a = 0;int b = 0;printf("请输入两个整数:>");scanf("%d %d", &a, &b);//保证 a < bif (a > b)(a = a + b, b = a - b, a = a - b);//创建一个数组记录数字个数int arr[10] = {0};//开始计数int i = 0;if (a * b <= 0)arr[0]++;for (i = a; i <= b; i++){int j = i;do{arr[j % 10]++;j /= 10;} while (j > 0);}for (i = 0; i < 10; i++){printf("%d--------%d\n", i, arr[i]);}return 0;
}