39: 7 has nothing to do with the number of

39: 7 has nothing to do with the number of

#include <stdio.h>
int main()
{
	int i,n,sum=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		int temp=i,count=0;
		while(temp)
		{
			if((temp%10)==7)count++;
			temp/=10;
		}
		if(!(count!=0||i%7==0))sum+=(i*i);
	}
	printf("%d\n",sum);
        return 0;
}

 

Guess you like

Origin blog.csdn.net/qq_42861250/article/details/90731513