Advertisement
vengat92

Multiplication Table

Aug 4th, 2014
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. #!/usr/bin/python
  2. #
  3. # Multiplication table using single for loop in python
  4. #
  5.  
  6. def multiply(table):
  7.     i = 1
  8.     for j in range(0, (table * 10)):
  9.         print '\t',
  10.         print ((j % 10) + 1)  * i,
  11.         if ((j + 1) % 10 == 0 and j != 0):
  12.             i += 1
  13.             print
  14.     print
  15.            
  16. table = int(raw_input("Enter the size of the table: "))
  17. multiply(table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement