Question: Hello, I need help with scheme programming. in this program, the input is number of lines. and output is how many points are at that

Hello, I need help with scheme programming.

in this program, the input is number of lines. and output is how many points are at that number.

for example (line1)--------1 . (line 2)-------2 .. (line 3)-------4 .... (line 4)-------8 ........ (line 5)-------16 ............... and so on...

(define (line n) (if (= 0 n) 0 (if (= 1 n) 1 (expt 2 (- n 1)))))

but the question is that

I need to modify this code so it could be a reverse program that I have above.

an example is if input will be (5, 6, 7, or 8) points output will be line 4

another example could be (9, 10, 11, 12, 13, 14, 15, or 16) points output will be line 5

and so on....

Thanks a lot.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!