Print Table on any Number in C


Prev Tutorial Next Tutorial

Print Table of Any Number Program in C

The concept of generating table of any number is, particular number is multiply from 1 to 10.

The concept of generate Table of any number is :
number * 1
number * 2
number * 3
number * 4
number * 5
number * 6
number * 7
number * 8
number * 9
number * 10

Find table of any number

Find Table of any Number in C

#include<stdio.h>
#include<conio.h>

void main()
{
int i,no,table=1;
clrscr();
printf("Enter any number : ");
scanf("%d",&no);
printf("Table of  %d \n",no);
for(i=1;i<=10;i++)
{
table=no*i;
printf("%d",table);
printf("\n");
}
getch();
}

Output

Enter any number : 5
Table of 5
5
10
15
20
25
30
35
40
45
50

Explanation of Program

Code

for(i=1;i< =10;i++)
{
table=no*i;
printf("%d",table);
printf("\n");
}

In the above Code execute for loop from 1 to 10, and given number is multiply by 1 and next iteration number is multiply by 2 and at third iteration number is multiply by 3,........10. and finally results are print on screen

Find table of any number using while loop

Table of any Number using while loop

#include<stdio.h>
#include<conio.h>

void main()
{
int a=1,no,table=1;
clrscr();
printf("Enter any num: ");
scanf("%d",&no);
while(a<=10)
{
table=a*no;
printf("%d",table);
printf("\n");
a++;
}
getch();
}

Output

Enter any num: 2
Table
2
4
6
8
10
12
14
16
18
20

Find table of any number using recursion

Program to print table of any number using recursion

#include<stdio.h>
#include<conio.h>

void main()
{
int table(int,int);
int n,i;
clrscr();
printf("Enter any num: ");
scanf("%d",&n);
for(i=1;i<=10;i++)
{
printf(" %d*%d= %d\n",n,i,table(n,i));
}
getch();
}
int table(n,i)
{
int t;
if(i==1)
{
return(n);
}
else
{
return(table(n,i-1)+n);
}
}

Prev Tutorial Next Tutorial



Download Projects

Advertisements

FREE Online Google Play APK Downloader

Buy APP Installs, Buy 100% Genuine Installs