Questions

How do you make a while loop in Python using Multiplication Tables?

In the example discussed below, we have used the while loop in python to create the multiplication table. We declared a variable ‘i’ and initialized the variable by 1. The loop will keep iterating until the i value reaches 10. Each time the while loop is iterated, the value of i will be increased by 1. When the value of i becomes greater than 10, the loop will be terminated.

python multiplication table

Source

Source Code for Python Multiplication table using the while loop

                    

#include 

int main()

{

  int a, b;

 

   printf("Enter a Number ");

   scanf("%d",&a);

   b=1;

   while(b<=10){

                

       printf("%d * %d = %d \n", a, b, a*b);

       ++b;

   }

     

 getch();

    

}

Output:

Enter a Number 

4

4 * 1 = 4

4 * 2 = 8

4 * 3 = 12

4 * 4 = 16

4 * 5 = 20

4 * 6 = 24

4 * 7 = 28

4 * 8 = 32

4 * 9 = 36

4 * 10 = 40

Related Questions

Related Topics

Share with friends

Customize your course in 30 seconds

Which class are you in?
5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
tutor
tutor
Ashhar Firdausi
IIT Roorkee
Biology
tutor
tutor
Dr. Nazma Shaik
VTU
Chemistry
tutor
tutor
Gaurav Tiwari
APJAKTU
Physics
Get Started

Leave a Reply

Your email address will not be published. Required fields are marked *

Download the App

Watch lectures, practise questions and take tests on the go.

Customize your course in 30 seconds

No thanks.