2015-10-24
展开全部
#include <stdio.h>
int main(void)
{
int i,t;
for(i=7;i<9999;i+=7)
{
for(t=i;t;t/=10)
{
if(t%10==5)
{
printf("%d\n",i);
break;
}
}
}
return 0;
}
追问
为什么只能输出5005以后的数字,我要从35开始的
展开全部
一、35
35+70
35+70*2
35+70*3
35+70*4
35 +70*5
35+70*6 等等----按这个规律找下去就行,但除50到60之间的和500到600之间
的和 5000到6000之间的
二、56 只属于50到60之间的
三、504
504+7
504+7*2
504+7*3
504+7*4 等等----按这个规律找下去就行,但只属于500到600之间的
四、5001
5001+7
5001+7*2
5001+7*3
5001+7*4 等等----按这个规律找下去就行,但只属于5000到6000之间的
35+70
35+70*2
35+70*3
35+70*4
35 +70*5
35+70*6 等等----按这个规律找下去就行,但除50到60之间的和500到600之间
的和 5000到6000之间的
二、56 只属于50到60之间的
三、504
504+7
504+7*2
504+7*3
504+7*4 等等----按这个规律找下去就行,但只属于500到600之间的
四、5001
5001+7
5001+7*2
5001+7*3
5001+7*4 等等----按这个规律找下去就行,但只属于5000到6000之间的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
在GCC环境下运行一下程序:
#include<stdio.h>
void main()
{
int a,b,n;
for (n=0;n<=9999;n++)
{
if (n%7==0)
{
a=n;
while(a!=0)
{
b=a/10;
b=a-b*10;
a=a/10;
if (b==5)
{printf ("%d\n",n);break;}
}
}
}
}
#include<stdio.h>
void main()
{
int a,b,n;
for (n=0;n<=9999;n++)
{
if (n%7==0)
{
a=n;
while(a!=0)
{
b=a/10;
b=a-b*10;
a=a/10;
if (b==5)
{printf ("%d\n",n);break;}
}
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
void main()
{
int a,b,c,d,s,f;
printf("35\n");
for(s=100;s<=999;s++)
{
a=s/100;
b=s/10%10;
c=s%10;
if((s%7==0)&&(a==5||b==5||c==5))
printf("%d\n",s);
}
for(f=1000;f<=9999;f++)
{
a=f/100%10;
b=f/10%10;
c=f%10;
d=f/1000;
if(((f%7==0)&&(a==5||b==5||c==5||d==5)))
printf("%d\n",f);
}
}
void main()
{
int a,b,c,d,s,f;
printf("35\n");
for(s=100;s<=999;s++)
{
a=s/100;
b=s/10%10;
c=s%10;
if((s%7==0)&&(a==5||b==5||c==5))
printf("%d\n",s);
}
for(f=1000;f<=9999;f++)
{
a=f/100%10;
b=f/10%10;
c=f%10;
d=f/1000;
if(((f%7==0)&&(a==5||b==5||c==5||d==5)))
printf("%d\n",f);
}
}
追问
56呢,56也是为什么程序没有,而且只能输出5005以后的数字啊
追答
额。这是我的失误,少写了个56。另外你把\n换成空格就能看到5000以前的了。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
35,56,105,154,175,245,252,259,315,350,357,385,455,504,511,518,525,532,539,546,553,560,567,574,581,588,595,651,658,665,735,756,805,854,875,945,952,959,1015,1050,1057,1085,1155,1225,1253,1295,1351,1358,1365,1435,1456,1505,1512,1519,1526,1533,1540,1547,1554,1561,1568,1575,1582,1589,1596,1645,1652,1659,1715,1750,1757,1785,1855,1925,1953,1995,2051,2058,2065,2135,2156,2205,2254,2275,2345,2352,2359,2415,2450,2457,2485,2506,2513,2520,2527,2534,2541,2548,2555,2562,2569,2576,2583,2590,2597,2625,2653,2695,2751,2758,2765,2835,2856,2905,2954,2975,3045,3052,3059,3115,3150,3157,3185,3255,3325,3353,3395,3451,3458,3465,3500,3507,3514,3521,3528,3535,3542,3549,3556,3563,3570,3577,3584,3591,3598,3605,3654,3675,3745,3752,3759,3815,3850,3857,3885,3955,4025,4053,4095,4151,4158,4165,4235,4256,4305,4354,4375,4445,4452,4459,4501,4508,4515,4522,4529,4536,4543,4550,4557,4564,4571,4578,4585,4592,4599,4655,4725,4753,4795,4851,4858,4865,4935,4956,5005,5012,5019,5026,5033,5040,5047,5054,5061,5068,5075,5082,5089,5096,5103,5110,5117,5124,5131,5138,5145,5152,5159,5166,5173,5180,5187,5194,5201,5208,5215,5222,5229,5236,5243,5250,5257,5264,5271,5278,5285,5292,5299,5306,5313,5320,5327,5334,5341,5348,5355,5362,5369,5376,5383,5390,5397,5404,5411,5418,5425,5432,5439,5446,5453,5460,5467,5474,5481,5488,5495,5502,5509,5516,5523,5530,5537,5544,5551,5558,5565,5572,5579,5586,5593,5600,5607,5614,5621,5628,5635,5642,5649,5656,5663,5670,5677,5684,5691,5698,5705,5712,5719,5726,5733,5740,5747,5754,5761,5768,5775,5782,5789,5796,5803,5810,5817,5824,5831,5838,5845,5852,5859,5866,5873,5880,5887,5894,5901,5908,5915,5922,5929,5936,5943,5950,5957,5964,5971,5978,5985,5992,5999,6055,6125,6153,6195,6251,6258,6265,6335,6356,6405,6454,6475,6503,6510,6517,6524,6531,6538,6545,6552,6559,6566,6573,6580,6587,6594,6615,6650,6657,6685,6755,6825,6853,6895,6951,6958,6965,7035,7056,7105,7154,7175,7245,7252,7259,7315,7350,7357,7385,7455,7504,7511,7518,7525,7532,7539,7546,7553,7560,7567,7574,7581,7588,7595,7651,7658,7665,7735,7756,7805,7854,7875,7945,7952,7959,8015,8050,8057,8085,8155,8225,8253,8295,8351,8358,8365,8435,8456,8505,8512,8519,8526,8533,8540,8547,8554,8561,8568,8575,8582,8589,8596,8645,8652,8659,8715,8750,8757,8785,8855,8925,8953,8995,9051,9058,9065,9135,9156,9205,9254,9275,9345,9352,9359,9415,9450,9457,9485,9506,9513,9520,9527,9534,9541,9548,9555,9562,9569,9576,9583,9590,9597,9625,9653,9695,9751,9758,9765,9835,9856,9905,9954,9975
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询