Program to print a table using while loop

In this program, we will print a table using while loop in Python.

Steps to solve the program
  1. Create a count variable and assign its value equal to 1.
  2. While value of the count variable is less than 11 multiply the count variable by 2 and store the value in another variable.
  3. Add 1 to the count variable after each iteration.
  4. 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
				
			

print the first 20 natural numbers

Sum of the first 10 natural numbers using the while loop

Leave a Comment