lich van nien
/*lich van nien*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
char i;
int nam,du,du1,nam1,sonam;
nam1=1990;
do
{
printf("
nhap vao so nam can tim:");
scanf("%d",&nam);
sonam=abs(nam-nam1);/*abs:tra lai ham tuyet doi cho so nguyen,
labs:tra lai ham tuyet doi cho so nguyen dai,fabs:tra lai ham tuyet doi cho so thuc*/
du=(sonam%10);
if(nam<nam1)
du=10-du;/*nam truoc 1990 thi nguoc lai*/
switch(du)/*lenh switch cung cap 1 tap cac kha nag de lua chon(nang cao cua if-else)*/
{
case 0: printf("nam: canh");break;/*break dung de ngat vong,switch gap break se dung lai*/
case 1: printf("nam: tan");break;
case 2: printf("nam: nham");break;
case 3: printf("nam: quy");break;
case 4: printf("nam: giap");break;
case 5: printf("nam: at");break;
case 6: printf("nam: binh");break;
case 7: printf("nam: dinh");break;
case 8: printf("nam: mau");break;
case 9: printf("nam: ky");break;
}/*tu 10 can vs du =>can cua nam*/
du1=(sonam%12);
if(nam<nam1)
du1=12-du1;/*nam truoc 1990 thi nguoc lai*/
switch(du1)
{
case 0: printf(" ngo");break;
case 1: printf(" mui");break;
case 2: printf(" than");break;
case 3: printf(" dau");break;
case 4: printf(" tuat");break;
case 5: printf(" hoi");break;
case 6: printf(" ti");break;
case 7: printf(" suu");break;
case 8: printf(" dan");break;
case 9: printf(" mao");break;
case 10: printf(" thin");break;
case 11: printf(" ty");break;
}/*tu 12 chi vs du1 => chi cua nam*/
printf("
neu muon thoat nhanh ESC");
i=getch();
}while(i!=27);
return 0;
}
/*10 can:Giap At Binh Dinh Mau Ki? Canh Tan Nham Quy*/
/*12 chi:Ty Suu Dan Mao Thin Ty Ngo Mui Than Dau Tuat Hoi*/
Bạn đang đọc truyện trên: Truyen247.Pro