50道javase练习题(50道javase练习题)

50道javase练习题(50道javase练习题)

ID:41381025

大小:59.24 KB

页数:19页

时间:2019-08-23

50道javase练习题(50道javase练习题)_第1页
50道javase练习题(50道javase练习题)_第2页
50道javase练习题(50道javase练习题)_第3页
50道javase练习题(50道javase练习题)_第4页
50道javase练习题(50道javase练习题)_第5页
资源描述:

《50道javase练习题(50道javase练习题)》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、50道javase练习题(50道javase练习题)[program1]Title:classicalquestion:thereareapairofrabbits,bornfromthirdmonthsafterbirtheachmonthapairofrabbits,smallrabbitsgrowuptothirdmonthslater,everymonthandapairofrabbits,iftherabbitdoesnotdie,Whatisthetotalnumberofrabbitspermonth?1.programanalysis:thenumb

2、erofrabbits・1,1,2,3,5,&13,21…[program2]Topic:determinethenumberofprimesbetween101-200,andtheoutputofallprimenumbers・1.programanalysis:themethodofjudgingprimenumbers:remove2tosqrt(anumber)withanumber,ifdivisible,Itindicatesthatthisnumberisnotprime,andisaprimenumber・[program3]Title:print

3、outallthe"Narcissusnumbers",socalled''narcissusnumber"referstoathreedigitnumber,thenumberofcubicandequaltothenumberitself.Forexample,"153〃isanarcissusnumber,Becausethreetimesthreetimesthreetimes5+3153=1.1.programanalysis:usetheforcycletocontrol100-999numbers,eachnumberdecomposesabit,te

4、nbits,hundreds・[program4]Title:apositiveintegerdecompositionofthequalityfactor・Forexample:enter90,printout90=2*3*3*5・Programanalysis:todecomposetheprimefactorofN,weshouldfirstfindaminimumprimenumberk,andthencompletethefollowingsteps:(1)iftheprimenumberisequaltoN,theprocessofdecomposing

5、theprimefactorisfinishedandprintedout.(2)ifn<>k,butnisdivisiblebyK,thevalueofKshouldbeprinted,anddividedbyNK,apositiveintegerasanewnyourepeatthefirststep・(3)ifnisnotdivisiblebyK,withk+1asthevalueofK,repeatthefirststep・[program5]Title:usethenestingofconditionaloperatorstocompletethisque

6、stion:studentswithacademicscores>=90pointsarerepresentedbyA,60-89pointsarerepresentedbyB,and60pointsarerepresentedbyC・1.programanalysis:(a>b)a:b?Thisisabasicexampleoftheconditionaloperator・[program6]EntertwopositiveintegersmandN,findthegreatestcommondivisorandleastcommonmultiple・1.prog

7、ramanalysis:usingrollingmethod・[program7]Title:enteralineofcharacters,respectively,thenumberofEnglishletters,spaces,numbetsandothercharacters・1.programanalysis:usingthewhilestatement,fortheinputcharacterisnot,.[program8]Topic:s=a+aa+aaa+aaaa+aa・・・A,whereaisanumber・Forexample,2+22+2

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。