Program to accept a number from the user and print the table of that nnumber (please give input and output)
Answers
Answered by
77
// CPP program to print table of a number
#include <iostream>
using namespace std;
int main()
{
int n = 5; // Change here to change output
for (int i = 1; i <= 10; ++i)
cout << n << " * " << i << " = "
<< n * i << endl;
return 0;
}
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
Answered by
3
Required Answer:-
Question:
- Write a python program to accept a number from the user and print the table of that number.
Solution:
Here comes the program.
n=int(input("Enter an integer number: "))
print("Here comes the table of",n)
for i in range(1,11):
print(n,"x",i,"=",n*i)
Algorithm:
- START.
- Accept a number.
- Iterate a loop in the range i = 1 to 11.
- Multiply each value of i with the number. Display the result.
- STOP.
See the attachment for output ☑.
Attachments:
Similar questions
Social Sciences,
2 months ago
English,
2 months ago
English,
2 months ago
Math,
4 months ago
Math,
4 months ago
Computer Science,
10 months ago
English,
10 months ago