Multiplication Table in C Using For Loop

Multiplication Table in C Using For Loop. This program will print the multiplication table in c language. Arithmetic Operator is a mathematical operator that is used to perform operations such as addition, subtraction, multiplication, division, modulus, and so on.

#include<stdio.h>
int main()
{
int number, i, tab;
printf("Enter the number");
scanf("%d", &number);
printf("\nTable of %d is:\n", number);
for(i=1; i<=5; i++)
{
tab = number*i;
printf("%d * %2d = %2d\n", number, i, tab);
}
return 0;
}

 

Output:

Enter the number5     

Table of 5 is:                                 

5 *  1 = 5

5 *  2 = 10
5 *  3 = 15
5 *  4 = 20 
5 *  5 = 25

For Loop in C Program

A for loop is a type of repetition control structure that allows us to create a loop that will be executed a predetermined number of times. The loop enables us to perform n steps in a single line. A “For” Loop is used to repeat a specific block of code a set number of times. 

The for statement allows you to specify the number of times a statement or compound statement should be repeated. A for statement’s body is executed zero or more times until an optional condition is met.

Post Increment to Execute Multiplication Table in C Using For Loop

A post-increment operator is used to increase the value of a variable after the expression has been completely executed. The value is first used in an expression and then incremented in the Post-Increment.

Return Statement in C

A return statement in computer programming causes execution to exit the current subroutine and resume at the point in the code immediately after the instruction that called the subroutine, known as its return address. The return statement returns the execution flow to the function from which it was called. This statement does not require any conditional statements.