Printing Multiplication Table in C


This program is a simple program that prints out a multiplication table of a given number up to a given limit.

  • The program starts by including the stdio.h header file, which contains the declarations of the functions used in the program.
  • In the main function, the program declares three integer variables "i", "t" , and "n" . It uses the printf function to prompt the user to enter the table number and the limit for the table, and uses the scanf function to read the input and store it in the variable "t" and "n" respectively.
  • The program then uses a for loop to iterate from 1 to the limit . Inside the loop, it uses the printf function to print out the current table number, the current value of the loop variable "i" , and the result of the multiplication of the table number and the current value of the loop variable.
  • Finally, the program returns 0 to indicate that the program has executed successfully.

Source Code

//Program to print multiplication tables in C Programming
 
#include<stdio.h>
 
int main()
{
    int i,t,n;
    printf("\nEnter The Table Name : ");
    scanf("%d",&t);//2
    printf("\nEnter The Limit      : ");
    scanf("%d",&n);//5
    for(i=1;i<=n;i++)
    {
        printf("\n%d X %d = %d",t,i,(t*i));
    }
    return 0;
}
 
To download raw file Click Here

Output

Enter The Table Name : 5

Enter The Limit      : 8

5 X 1 = 5
5 X 2 = 10
5 X 3 = 15
5 X 4 = 20
5 X 5 = 25
5 X 6 = 30
5 X 7 = 35
5 X 8 = 40

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C