Online Snippets Library

Create Table program in C

To Create table in C, We need to use iteration and increment it with the value of which table is being printed.

  • Define table value k
  • Iterate from i = k to (k*10)
  • Display i and Increment i by k.
C Program
#include <stdio.h>

int main() {
   int i, j, k;

   k = 3;
   j = 1;
   
   for(i = k; i <= (k*10); i+=k) {
      printf("%3d  x %2d  =  %3d\n", k, j, i);
      j++;
   }

   return 0;
}

Output

3 x 1 = 3 3 x 2 = 6 3 x 3 = 9 3 x 4 = 12 3 x 5 = 15 3 x 6 = 18 3 x 7 = 21 3 x 8 = 24 3 x 9 = 27 3 x 10 = 30