Flowchart + Python.
Ask the user for a value. Then, ask the user for the number of expressions of that value. Use While Loops to make a program.
So then, it should be so that 5 expressions for the value 9
would be:
9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
Flowcharts and Python Code. Not just Python code.
If you have any queries please comment in the comments section I will surely help you out and if you found this solution to be helpful kindly upvote.
Solution :
# function to calculate and return the product
def calculate(val,i):
# calculate product
prod = val*i
# return the product
return prod
# function to display the table
def display(val,n):
# initialize i=1
i=1
# iterate while loop n times
while(i<=n):
# call the calculate function to get the product
prod=calculate(val,i)
# print val, i and product
print(val,"*",i,"=",prod)
# increment i
i=i+1
# function to take input
def take_input():
# input value
val = int(input())
# input the number of expressions
n = int(input())
# call the display function
display(val,n)
# call the take_input function
take_input()
Get Answers For Free
Most questions answered within 1 hours.