Skip to content

Instantly share code, notes, and snippets.

@aimerneige
Created November 23, 2020 02:30
Show Gist options
  • Save aimerneige/05969126c9df02f3a5df88c22e30ab50 to your computer and use it in GitHub Desktop.
Save aimerneige/05969126c9df02f3a5df88c22e30ab50 to your computer and use it in GitHub Desktop.
#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