write a program to display the table of 10
Answers
Answered by
1
Answer:
# Multiplication table (from 1 to 10) in Python
num = 10
# To take input from the user
# num = int(input("Display multiplication table of? "))
# Iterate 10 times from i = 1 to 10
for i in range(1, 11):
print(num, 'x', i, '=', num*i)
Answered by
0
Print table of 10 :
Output:
10
20
30
40
50
60
70
80
90
100
Explanation:
Program:
#include <iostream> //defining header file
using namespace std;
int main() //defining main method
{
int n1=10,tab; //defining vriable
for(int i=1;i<=10;i++) //using loop to calculate value
{
tab=i*n1; //holding calculated value
cout<<tab<<endl; //print value
}
return 0;
}
Explanation:
- In the above code three integer variable "i,n1, and tab" is declared in which n1 variable we assign a value that is 10, and other variables "tab and i" is used in the loop.
- In the next line for loop is declare, that starts from the 1 and ends when the value of the variable i is less than equal to 10.
- Inside the loop, the tab variable is used that calculates the table of the given number and prints its value.
Learn more:
- print table: https://brainly.in/question/2373092
Similar questions