Object
Write a program to print the table of a given number.
Algorithm
- Declare integer variables num and i.
- Read num.
- Set i = 1.
- DO
- Write num*i.
- i++.
- WHILE i <= 10.
- [End of DO-WHILE loop.]
- Exit.
Flowchart

C++ Source Code
// program 67
#include<iostream>
using namespace std;
int main()
{
int num;
cout << "Enter any number: ";
cin >> num;
int i = 1;
do
{
cout << "\n" << num << " * " << i << " = " << num * i;
i++;
}
while (i <= 10);
return 0;
}
C Source Code
/*program 67*/
#include<stdio.h>
int main()
{
int num, i;
printf("Enter any number: ");
scanf("%d", &num);
i = 1;
do
{
printf("\n%d * %d = %d", num, i, num*i);
i++;
}
while(i<=10);
return 0;
}
Output
Enter any number: 8
8 * 1 = 8
8 * 2 = 16
8 * 3 = 24
8 * 4 = 32
8 * 5 = 40
8 * 6 = 48
8 * 7 = 56
8 * 8 = 64
8 * 9 = 72
8 * 10 = 80
