2025-03-06 23:47:59 +08:00

41 lines
850 B
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*-------------------------------------------------------
功能输出100到1000之间的各位数字之和能被15整除的所有数输出时每10个一行。
输出每个数占5个字符
159 168 177 186 195 249 258 267 276 285
294 339 348 357 366 375 384 393 429 438
447 456 465 474 483 492 519 528 537 546
555 564 573 582 591 609 618 627 636 645
654 663 672 681 690 708 717 726 735 744
753 762 771 780 807 816 825 834 843 852
861 870 906 915 924 933 942 951 960
-------------------------------------------------------*/
#include<stdio.h>
main()
{
int m,n,k,i=0;
for(m=100;m<=1000;m++)
{
k=0;
n=m;
/**********Program**********/
while(n){
k+=n%10;
n/=10;
}
if(k%15==0){
i++;
printf("%5d", m);
if(i%10==0){
printf("\n");
}
}
/********** End **********/
}
}