看板 C_and_CPP 關於我們 聯絡資訊
也是recursive版本,不過邏輯比較好懂XD #include <stdio.h> void nine(int i, int j) { if (i < 10) { if (j < 10) { printf("%d * %d = %2d \n", i, j, i*j); nine(i, j + 1); } else { printf("\n"); i++; nine(i, 1); } } } int main() { nine(1, 1); return 0; } ※ 引述《RealJack ()》之銘言: : 這系列的問題不外乎有以下的風格 : 1. 精簡型 : 2. 炫技型 : 3. 搞笑型 : 4. 鑽漏洞型 : 5. 創意型 : 個人認為1,3,5比較有意思 : 以下是我的想法 : 各位可參考一下...XD : include <stdio.h> : void f(int n) : { : if(n == 100) : return; : if(n % 10 != 0) : printf("%d * %d = %d\n", n/10, n%10, (n/10)*(n%10)); : f(n+1); : } : void main() : { : f(11); : } -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.217.70.24 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1531853990.A.00F.html
Schottky: 這是正解 07/18 05:29
lc85301: 六篇奇文之後終於出現正解了,可喜可賀 07/18 22:53
BellCranell: code有所謂正解哦 @@? 07/19 17:05
Schottky: 這麼說吧,是出題老師想看到的東西 07/19 22:20
sarafciel: 其他答案基本上都是超過還在寫這種題目的學生程度的XD 07/19 22:39
sorryla: 某些答案不只超過學生程度,我看也超過老師的程度吧XD 07/20 03:35