

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A series of programming exercises focused on basic calculations and conversions. The exercises cover topics such as converting time to seconds, calculating pizza needs for a party, determining the hypotenuse of a right triangle, finding the area of a triangle using heron's formula, calculating pizza order costs with sales tax, finding the square root of a number, and determining the volume and area of a cylinder. Additionally, there's a warm-up exercise involving user input and type conversion. These exercises are designed to help students practice fundamental programming concepts and mathematical calculations. A practical application of programming skills in everyday scenarios, enhancing understanding and problem-solving abilities.
Typology: Exams
1 / 3
This page cannot be seen from the preview
Don't miss anything!


1 nput, VFand rather VFthan ime VFin umber VFof VFeople s VFlegs VF(sides you VFknow VFthe VFngle VFas VFinput, mber VFof VFpizzas 1.22.1 VFLab: VFConvert VFto VFSeconds Write VFa VFprogram VFthat VFreads VFin VFhours, VFminutes, VFand VFseconds VFas VFi VFoutputs VFthe VFtime VFin VFseconds VFonly.: 2.22.2 VFLab: VFConvert VFfrom VFSeconds People VFfind VFit VFeasier VFto VFread VFtime VFin VFhours, VFminutes, VFand VFseconds VFjust VFseconds. Write VFa VFprogram VFthat VFreads VFin VFseconds VFas VFinput VFand VFoutputs VFthe VFt VFminutes, VFand VFseconds.: 3.22.3 VFLab: VFPizza VFParty Given VFthe VFnumber VFof VFpeople VFattending VFa VFpizza VFparty, VFoutput VFthe VFn VFneeded VFpizzas VFand VFtotal VFcost. VFFor VFthe VFcalculation, VFassume VFthat VFp VFslices VFon VFaverage VFand VFeach VFpizza VFhas VF 12 VFslices VFand VFcosts VF$14.95.: 4.22.4 VFLab: VFHypotenuse Given VFtwo VFnumbers VFthat VFrepresent VFthe VFlengths VFof VFa VFright VFtriangle' VFadjacent VFto VFthe VFright VFangle), VFoutput VFthe VFlength VFof VFthe VFthird VFside VF(i.e. VFwith VFtwo VFdigits VFafter VFthe VFdecimal VFpoint.: 5.22.5 VFLab: VFArea VFof VFa VFTriangle Using VFHeron's VFformula, VFyou VFcan VFcalculate VFthe VFarea VFof VFa VFtriangle VFif VFlengths VFof VFall VFthree VFsides. VFGiven VFthe VFlength VFof VFeach VFside VFof VFa VFtria VFcalculate VFthe VFarea VFof VFthe VFtriangle VFusing VFHeron's VFformula VFas VFfollow VFs VF= VFhalf VFof VFthe VFtriangle's VFperimeter area VF= VFthe VFsquare VFroot VFof VFs(s-a)(s-b)(s-c), VFwhere VFa, VFb, VFand VFc VFare VFeach VFsides VFof VFthe VFtriangle.: 6.22.6 VFOrdering VFPizza A VFlocal VFpizza VFshop VFis VFselling VFa VFlarge VFpizza VFfor VF$9.99. VFGiven VFthe VFnu VFto VForder VFas VFinput, VFoutput VFthe VFsubtotal VFfor VFthe VFpizzas, VFand VFthen VFou VFafter VFapplying VFa VFsales VFtax VFof VF6%: 7.22.7 VFLAB: VFSquare VFroot
2 f VFthe VFgiven Given VFa VFfloating-point VFnumber VFas VFinput, VFoutput VFthe VFsquare VFroot VFo VFnumber.: 8.22.8 VFLAB: VFVolume VFand VFarea VFof VFcylinder