C Examples Table Style
# C Examples - Table-Style Data Output
[ C Examples](#)
Output data from 1 to 100 in a 10x10 matrix format.
## Example
#includeint main(){int i, j, count; for(i = 1; i<= 10; i++){for(j = i; j<=100; j += 10)printf(" %3d", j); printf("n"); }return 0; }
Output:
1 11 21 31 41 51 61 71 81 912 12 22 32 42 52 62 72 82 923 13 23 33 43 53 63 73 83 934 14 24 34 44 54 64 74 84 945 15 25 35 45 55 65 75 85 956 16 26 36 46 56 66 76 86 967 17 27 37 47 57 67 77 87 978 18 28 38 48 58 68 78 88 989 19 29 39 49 59 69 79 89 9910 20 30 40 50 60 70 80 90 100
Output an arithmetic sequence in a 10x10 matrix format.
## Example
#includeint main(){int i, j, count; int start, end; start = 2, end = 10; for(i = start; i<= end; i++){count = i; for(j = 1; j<= 10; j++){printf(" %3d", count*j); }printf("n"); }return 0; }
Output:
2 4 6 8 10 12 14 16 18 203 6 9 12 15 18 21 24 27 304 8 12 16 20 24 28 32 36 405 10 15 20 25 30 35 40 45 506 12 18 24 30 36 42 48 54 607 14 21 28 35 42 49 56 63 708 16 24 32 40 48 56 64 72 809 18 27 36 45 54 63 72 81 9010 20 30 40 50 60 70 80 90 100
Multiplication table format.
## Example
#includeint main(){int i, j, n; n = 3; j = 1; for(i = n; i<= (n*10); i+=n){printf("%3d x %2d = %3dn", n, j, i); j++; }return 0; }
Output:
3 x 1 = 33 x 2 = 63 x 3 = 93 x 4 = 123 x 5 = 153 x 6 = 183 x 7 = 213 x 8 = 243 x 9 = 273 x 10 = 30
[ C Examples](#)
YouTip