Posted onInalgorithmViews: Changyan: Symbols count in article: 267Reading time ≈1 mins.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
include<stdio.h> int main() { int i, j, result; printf("\n"); for (i = 1; i < 10; i++) { for (j = 1; j <= i; j++) { result = i * j; printf("%d*%d=%-3d", i, j, result); /*-3d表示左对齐,占3位*/ } printf("\n"); /*每一行后换行*/ } }