用while语句编程实现:求100-1000以内能被9整除的数的个数
%求余数
#include <stdio.h>
int main()
{
int n = 10, m = 1000,count = 0;
while ( n<=m )
{
if (((n++) % 9) == 0)//对9取余
count++;
}
printf("%d\n", count);//110个
//int tmp = (1000 - 10) / 9;//简单方法
return 0;
}