Type the program's output target = int(input()) n = int(input()) step = 4 while n >= target: print(n * 2) n -= step Input 20 80 Output
Added by Brian Q.
Close
Step 1
The program takes two inputs: target and n. Then it enters a while loop that continues as long as n >= target. Inside the loop, it prints n * 2 and then decreases n by step (which is set to 4). Show more…
Show all steps
Your feedback will help us improve your experience
Shyam P and 87 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Consider the following algorithm, which takes an input integer n and prints one or more integers: input(n) set i = 1 while i < n begin replace i by i + 1 set k = n while k > 2 begin If i % k = 0 then print(i) replace k by k - 1 end end What integers will be printed? If the input integer is 86.
Shyam P.
Find the output of the program given below. 10 Read $P, N, R$ 20 Data $2000,2,20$ 30 Let $A=P\left[(1+R / 100)^{N}\right]$ 40 Print $A$ 50 END (1) 3240 (2) 2880 (3) 3840 (4) 3360
Trace Algorithm 4 when it is given $m=7, n=10,$ and $b=2$ as input. That is, show all the steps Algorithm 4 uses to find $2^{10} \bmod 7 .$
Induction and Recursion
Recursive Algorithms
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD