How to print the first N tables in c language using for loop

How to print the first N tables in c language using for loop

In this post, you will learn to create the multiplication table of a number entered by the user.

How to print the first N tables in c language using for loop



For better understand this example, you should have the knowledge of the following C programming topics:
  1. C Programming Operators
  2. C for Loop

Program to print the first N tables in c language using for loop

#include<stdio.h> 
main() 
int n,i,m,j; 
printf("\n Enter the value of N :"); 
scanf("%d",&n); 
for(i=1;i<=n;i++) 
printf("\n TABLE OF %d IS: ",i); 
for(j=1;j<=10;j++)
{
m=i*j;
printf("\n %d %d %d",i,j,m); 
getche(); 
getche();
}

Output:


Enter the value of N: 3 
TABLE OF 1 IS: 1*1=1
1*2=2
1*3=3 
1*4=4 
1*5=5 
1*6=6 
1*7=7 
1*8=8 
1*9=9 
1*10=10 
TABLE OF 2 IS: 
2*1=2 
2*2=4 
2*3=6 
2*4=8 
2*5=10 
2*6=12 
2*7=14 
2*8=16 
2*9=18 
2*10=20 
TABLE OF 3 IS: 
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 of the series.
Previous
Next Post »

Please do not entering spam link in the comment box ConversionConversion EmoticonEmoticon