num 6 Ex 6) This exercise uses sub-algorithms. Trace it for when input value is 6 and complete the trace tables. Also no

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

num 6 Ex 6) This exercise uses sub-algorithms. Trace it for when input value is 6 and complete the trace tables. Also no

Post by answerhappygod »

Num 6 Ex 6 This Exercise Uses Sub Algorithms Trace It For When Input Value Is 6 And Complete The Trace Tables Also No 1
Num 6 Ex 6 This Exercise Uses Sub Algorithms Trace It For When Input Value Is 6 And Complete The Trace Tables Also No 1 (49.49 KiB) Viewed 20 times
num 6 Ex 6) This exercise uses sub-algorithms. Trace it for when input value is 6 and complete the trace tables. Also note that there are two variables name num, one in the main algorithm and another in the sub-algorithm. They are not related. Assume input is a positive integer. Write pre- post-conditions for each of these algorithms (the main one and the sub-algorithm). Note that the prime sub-algorithm is similar to the algorithm in Ex 1) but instead of reading input and producing outputs, it has a parameter num, and it returns the result. Also note that the =true is in gray color, which means it can be ignored. Note that since the sub-program is called several times, it's better that you use separate trace tables, one for each call, as shown below. output start num 142 i<i+1 is num prime()= true end F prime(num) start flag-true d-2 flag = true and d's num/2 num mod d = 0 flag-false ded+1 ret flag num flag 4 returned value 2 3 لا 4 flag flag d # returned value returned value
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply