100到1000之间有多少个数其各位数字之和是5

<span style="font-family: Arial, Helvetica, sans-serif;">#include <stdio.h></span>
int main()
{
	int i, s, k, count = 0;
	for (i = 100; i < 1000; i++)
	{
		s = 0;
		k = i;
		while (k)
		{
			s += k % 10;
			k = k / 10;
		}
		if (s != 5)
			continue;
		else
			count++;
	}
	printf("%d
", count);
	return 0;
}

   

原文地址:https://www.cnblogs.com/liesun/p/7350337.html