In this program, we will print a table using while loop in Python.
Steps to solve the program
- Create a count variable and assign its value equal to 1.
- While value of the count variable is less than 11 multiply the count variable by 2 and store the value in another variable.
- Add 1 to the count variable after each iteration.
- Print the output.
count = 1
while count < 11:
a = count*2
print(count,"*",2,"=",a)
count += 1
Output :
1 * 2 = 2
2 * 2 = 4
3 * 2 = 6
4 * 2 = 8
5 * 2 = 10
6 * 2 = 12
7 * 2 = 14
8 * 2 = 16
9 * 2 = 18
10 * 2 = 20