天干地支
user_3763047219
c_cpp
3 years ago
418 B
6
Indexable
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
int num;
int index1, index2;
char text1[][4] = { "甲", "乙", "丙", "丁", "戊",
"己", "庚", "辛", "壬", "癸" };
char text2[][4] = { "子","丑","寅","卯","辰","巳",
"午","未","申","酉","戌","亥"};
scanf("%d", &num);
index1 = num % 10;
index2 = num % 12;
printf("%s%s", text1[index1], text2[index2]);
}
Editor is loading...