Question: 7 . 1 6 Programming Assignment, Question 3 Write a program that takes in two positive integer numbers ( N ) and ( D )
Programming Assignment, Question
Write a program that takes in two positive integer numbers and and prints out the first numbers divisible by The final output
should be a list of numbers divisible by For example, if you count up from and are given and then your output list should
be
LAB
ACTIVITY
: Programming Assignment, Question
main.py
# Read input
N int
D int
# Initialize an empty list to store numbers divisible by D
divisiblenumbers
# Initialize a variable to keep track of the current number
currentnumber
# Iterate until the list contains N numbers
while lendivisiblenumbers N:
# Check if the current number is divisible by D
if currentnumber D :
# If it is add it to the list
divisiblenumbers.appendcurrentnumber
# Move to the next number
currentnumber
# Print the list of numbers divisible by D
printdivisiblenumbers
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
