Beta Coder

Learn code like Beta Coder.

Breaking

Thursday, October 1, 2020

C Progra To Print a Table of Any Given Number

Print a Table of Any Given Number

C Progra To Print a Table of Any Given Number
In this program we learn how to print a table of any given number provided by user using C.
C program to print a table of any given number
// Print a Table of Any Given Number
#include<stdio.h>
#include<conio.h>
void main()
{
	int n, i;
	clrscr();
	printf("\n Enter a no to know table : ");
	scanf("%d",&n);
	printf("\n The table of given no : ");
	for(i = 1; i <= 10; i++)
		printf("\n %d * %2d = %d", n, i, (n * i));
	getch();
}	
OUTPUT:
   Enter a no to know table : 4
   The table of given no :
    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

No comments:

Post a Comment