Created
December 23, 2017 15:00
-
-
Save YuerLee/846e919407e1da7980467c717df97a7d to your computer and use it in GitHub Desktop.
變形乘法表
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
int length, n; | |
scanf("%d %d", &length, &n); | |
for (int i = 1; i <= n; i += length) { | |
printf("\n"); | |
for (int j = 1; j <= 9; j++) { | |
// 每列 length 行,但總數不得超過 n 個 | |
for (int col = 0; (col < length) && (i + col <= n); col++) { | |
printf("%2d * %d ", i + col, j); | |
} | |
printf("\n"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment