#include <stdio.h>
#include <string.h>
int count_fun(int m)//一个数里的1的个数之和
{
int number=0;
while(m)
{
if(m%10==1)
number++;
m=m/10;
}
return number;
}
int main()
{
unsigned int i=0;
unsigned int n=15;
int count=0;
for(i=0;i<n;i++)//n个数里的1的个数之和
count+=count_fun(i);
printf("%d",count);
}
#include <string.h>
int count_fun(int m)//一个数里的1的个数之和
{
int number=0;
while(m)
{
if(m%10==1)
number++;
m=m/10;
}
return number;
}
int main()
{
unsigned int i=0;
unsigned int n=15;
int count=0;
for(i=0;i<n;i++)//n个数里的1的个数之和
count+=count_fun(i);
printf("%d",count);
}