Program to generate a table of a given input number

Here is the program which generates a table of a given input number.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "conio.h"
#include "stdio.h"
 
void main()
{
  int num,result,i=1;
  printf("\nEnter a number to generate the table : ");
  scanf("%d",&num);
  printf("\nThe table of %d is given below",num);
  while(i<=10)
  {
  result=num*i;
  printf("\n\t %d * %d = %d",num,i,result);
  i++;
  }
getch();
}

Output

Enter a number to generate the table : 3
The table of 3 is given below
	3 * 1 = 3
	3 * 2 = 6
	3 * 3 = 9
	3 * 4 = 12
	3 * 5 = 15
	3 * 6 = 18
	3 * 7 = 21
	3 * 8 = 24
	3 * 9 = 27
	3 * 10 = 30
Chitra
Chitra

Leave a Reply

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

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.

    StudentProjects.in