Answer:
I've implemented this program using python
userinput = int(input("Length: "))
mylist = []
mylist.append(userinput)
for i in range(1,userinput+1):
userinp = int(input("Input: "))
mylist.append(userinp)
smallval = mylist[1]
for i in range(1,len(mylist)):
if smallval > mylist[i]:
smallval = mylist[i]
for i in range(1,len(mylist)):
mylist[i] = mylist[i] - smallval
for i in range(1,len(mylist)):
print(mylist[i],end=' ')
Explanation:
I've added the full source program as an attachment where I used comments to explain difficult lines
Answer:
Similar to a While loop, a For loop consists of three parts: the keyword For that starts the loop, the condition being tested, and the EndFor keyword that terminates the loop.
Explanation:
Loop statements usually have four components: initialization (usually of a loop control variable), continuation test on whether to do another iteration, an update step, and a loop body.
The correct answer is: True
Explanation:
Consider the following program:
<span>class Main {
int a = 10;
public static void main(String[] args) {
add();
}
private static void add() {
int b = a+20;
System.out.println(b);
}<span>
}
The output of the above program is 30. As you can see the variable a is declared outside the method, whereas variable b is declared inside the method.</span></span>