Created
November 23, 2020 02:30
-
-
Save aimerneige/05969126c9df02f3a5df88c22e30ab50 to your computer and use it in GitHub Desktop.
This file contains 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> | |
void SIC(int num); | |
void TNIC(int num); | |
int main(int argc, char const *argv[]) | |
{ | |
for (int i = 1; i <= 9; i++) { | |
for (int j = 1; j <= i; j++) { | |
SIC(j); | |
SIC(i); | |
if ( (i * j) < 10 ) { | |
printf("得"); | |
} | |
SIC(i * j); | |
printf("\t"); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} | |
void SIC(int num) { | |
if (num < 10) { | |
TNIC(num); | |
} | |
else if (num < 100) { | |
int a = (num % 10); | |
num /= 10; | |
int b = num; | |
if (b == 1) { | |
if (a == 0) { | |
TNIC (1); | |
} | |
else { | |
TNIC(10); | |
} | |
} | |
else { | |
TNIC(b); | |
} | |
if ( (b != 1) && (a != 0) ) { | |
TNIC(10); | |
} | |
TNIC(a); | |
} | |
} | |
void TNIC(int num) | |
{ | |
switch (num) { | |
case 0: printf("十"); break; | |
case 1: printf("一"); break; | |
case 2: printf("二"); break; | |
case 3: printf("三"); break; | |
case 4: printf("四"); break; | |
case 5: printf("五"); break; | |
case 6: printf("六"); break; | |
case 7: printf("七"); break; | |
case 8: printf("八"); break; | |
case 9: printf("九"); break; | |
case 10: printf("十"); break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment