Write an algorithm and draw a flowchart to print the square of all numbers from LOW to HIGH. Test with LOW=1 and HIGH=10.

Recommended Answers

All 2 Replies

Hint ...

>>> range(1, 11)
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def square(low, high):
  count = 1
  for count in range(low,(high+1), 1):
    print (count, " squared is ", count**2)

lowNum = raw_input("Please insert low value")
highNum = raw_input("Please insert high value")
square(int(lowNum), int(highNum))

This may work, haven't tested it as i'm at school; I have no executable rights in library.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.