Click here to download

GET TABLE OF ANY NUMBER FROM ZERO TO INFINITY

TABLE OF ANY NUMBER HERE:

Enter the number whose table you want 👇

Generate Table




Table Program in C

This article will write the table programs using loops (for, do-while, and while loop) and functions (user-defined and recursion function) in the C programming language.

A table (or multiplication table) of numbers is generated by multiplying a constant number with an iterative number from 1 to 10 to get the table. In other words, we can get the table of a number by multiplying the given number with counting from 1, 2, 3, 4, 5, ..., 9, 10. And on each iteration, the value of counting is incremented by 1, which goes up to 10, to print a complete table.

For example, suppose we want to write the table of 5 in C language. So, first, we take 5 as input from the user, and then, we use a loop or function that multiplies the number 5 by 1 (5 * 1), and then (5 * 2), (5 * 3), to the last (5 * 10) number, to get the complete table of the given numbers.

Table Program in C

Different ways to generate the table program

Following are the various ways to generate the table program in the C programming language.

  1. Using for loop
  2. Using while loop
  3. Using do-while loop
  4. Using user-defined function
  5. Using recursion function
  6. Using if and goto statement
  7. Using for loop and pointer
  8. Using nested for loop

Program to generate the table of a given number using for loop

Let's consider an example to print the table of the specific number using for loop in the C programming language.

Program1.c

  1. #include <stdio.h>  
  2. int main()  
  3. {  
  4.     int num, i; // declare a variable  
  5.     printf (" Enter a number to generate the table in C: ");  
  6.     scanf (" %d", &num); // take a positive number from the user  
  7.       
  8.     printf ("\n Table of %d", num);  
  9.     // use for loop to iterate the number from 1 to 10  
  10.     for ( i = 1; i <= 10; i++)  
  11.     {  
  12.         printf ("\n %d * %d = %d", num, i, (num*i));  
  13.     }  
  14.     return 0;  
  15. }  

No comments

Buy Here   Brand ‎Apple Manufacturer ‎Apple, Apple Inc, One Apple Park Way, Cupertino, CA 95014, USA. or Apple India Private Limited No.24, ...