欢迎来到天天文库
浏览记录
ID:19460745
大小:43.00 KB
页数:21页
时间:2018-10-02
《[4] 第三次上机作业_1(国外英语资料)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、[4]第三次上机作业_1Inthethirdtime,theselectionstructureofthemachinejob3.1showstwogradesTheprogramfillsinanddoesnotchangethestatementsassociatedwiththeinputoutput.Enterastudent'smathscoreifitisbelow60andoutput"Fail",otherwisetheoutput"Pass".Theinput60TheoutputPass【1V
2、oidmain(){Intmark;Scanf("%d",&mark);If(mark<60)Printf("Fail");TheelsePrintf("Pass");}3.2findtheminimumTheprogramfillsinanddoesnotchangethestatementsassociatedwiththeinputoutput.Enterfourintegersandoutputtheminimum.Theinput12June1,90TheoutputMinis1【2Voidma
3、in(){Inta,b,c,d,min;Scanf(%d%d%d%d%d%d).Min=a;If(b4、esofthetrianglea,b,c,ifyoucanformatriangle,theareaoftheoutputareaandtheperimeterKeep2decimalplaces);Otherwise,output"Thesesidesdonotcorrespondtoavalidtriangle".Inatriangle,thesumofanytwosidesisgreaterthanthethird.Theformulafortheareaofatriangle:Aere*area=s(s-5、a)(s-b)(s-c)S=(a+b+c)/2Theinput553TheoutputArea=7.15;Generating=13.00[3]includeVoidmain(){Floata,b,c,area,dot,s;Scanf("%f%f%f").S=(a+b+c)/2.0;If(a+b>c)and(b+c>a),(c+a>b)){Area=SQRT(s*(s-a)*(s-b)*(s-c));Generating=a+b+c;Printf("area=%.")6、}TheelsePrintf("sidesdonotcorrespondtoavalidtriangle.");}Thesignofthenumber3.4Theprogramfillsinanddoesnotchangethestatementsassociatedwiththeinputoutput.Ifxisgreaterthan0,yisequalto1;Ifxis0,yis0;Otherwise,yisequaltonegative1,andthenweoutputy.Theinput2Theout7、putone【4Voidmain(){Intx,y;Scanf("%d",&x);Ifx,>,0,yis1;Elseifx=0,y=0;Theelsey=1;Printf("%d",y);}CalculateindividualincometaxEnteranemployee'smonthlysalary,andexportthetaxableincometax(reserve2decimalplaces).Tax=rate*(salary-850)Whensalary<=850,rate=0;Whenthe8、salary<=1350,therate=5;Whenthesalary<=2850,therate=10;Whenthesalary<=5850,therate=15;Whenthesalaryis5850,therateis20;Theinput1010.87TheoutputTax=8.04[5]include
4、esofthetrianglea,b,c,ifyoucanformatriangle,theareaoftheoutputareaandtheperimeterKeep2decimalplaces);Otherwise,output"Thesesidesdonotcorrespondtoavalidtriangle".Inatriangle,thesumofanytwosidesisgreaterthanthethird.Theformulafortheareaofatriangle:Aere*area=s(s-
5、a)(s-b)(s-c)S=(a+b+c)/2Theinput553TheoutputArea=7.15;Generating=13.00[3]includeVoidmain(){Floata,b,c,area,dot,s;Scanf("%f%f%f").S=(a+b+c)/2.0;If(a+b>c)and(b+c>a),(c+a>b)){Area=SQRT(s*(s-a)*(s-b)*(s-c));Generating=a+b+c;Printf("area=%.")
6、}TheelsePrintf("sidesdonotcorrespondtoavalidtriangle.");}Thesignofthenumber3.4Theprogramfillsinanddoesnotchangethestatementsassociatedwiththeinputoutput.Ifxisgreaterthan0,yisequalto1;Ifxis0,yis0;Otherwise,yisequaltonegative1,andthenweoutputy.Theinput2Theout
7、putone【4Voidmain(){Intx,y;Scanf("%d",&x);Ifx,>,0,yis1;Elseifx=0,y=0;Theelsey=1;Printf("%d",y);}CalculateindividualincometaxEnteranemployee'smonthlysalary,andexportthetaxableincometax(reserve2decimalplaces).Tax=rate*(salary-850)Whensalary<=850,rate=0;Whenthe
8、salary<=1350,therate=5;Whenthesalary<=2850,therate=10;Whenthesalary<=5850,therate=15;Whenthesalaryis5850,therateis20;Theinput1010.87TheoutputTax=8.04[5]include
此文档下载收益归作者所有