In: Computer Science
Write a loop to print a list of numbers starting at 64 and ending at 339. Justify your syntax.
After getting your question I have two solutions in my mind I am showing these. Even you dint mention the language so I used python.
num_list=[]
for i in range(64,340): #looping from 64 to 339
num_list.append(i)
print("Numbers starting at 64 and ending at 339:")
for j in num_list:
print(j)
Output:
num_list=[]
for i in range(0,1000): #looping through 0 to 1000 as there will be lots of number so just assuming 1000
num_list.append(int('64'+str(i)+'339'))#concatenating 64 at the beginning and 339 at the end then converted them into int
print("Numbers starting with 64 and ending with 339:")
for j in num_list: #printing the elements
print(j)
Please let me know if this is what you have asked for. Any query you can ask in the comment.Thanks