Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- int main(){
- char *color[] = { "green", "red","yallow" , "white", "black"};
- int colorInd = 0;
- char *animal[] ={"rat", "cow" , "tiger", "rabit", "dragon", "snake", "horse", "sheep", "monrey", "cheken", "dog", "pig"};
- int animalInd = 0;
- int count;
- printf("Input year : ");
- int year;
- scanf("%i", &year);
- year -= 1984;
- year %= 60;
- for(int i = 0; i < year; i++){
- if(year > 12)
- count = 12;
- else
- count = year;
- animalInd = 0;
- for(int j = 0; j < count; j++)
- animalInd++;
- year -= 12;
- colorInd++;
- }
- printf("Year of %s and %s\n", color[colorInd-1], animal[animalInd-1]);
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment