Nikitasobakabmx

Untitled

Jun 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3.  
  4. int main(){
  5.     char *color[] = { "green", "red","yallow" , "white", "black"};
  6.     int colorInd = 0;
  7.     char *animal[]  ={"rat", "cow" , "tiger", "rabit", "dragon", "snake", "horse", "sheep", "monrey", "cheken", "dog", "pig"};
  8.     int animalInd = 0;
  9.     int count;
  10.     printf("Input year : ");
  11.     int year;
  12.     scanf("%i", &year);
  13.     year -= 1984;
  14.     year %= 60;
  15.     for(int i = 0; i < year; i++){
  16.         if(year > 12)
  17.             count = 12;
  18.         else
  19.             count = year;
  20.         animalInd = 0;
  21.         for(int j = 0; j < count; j++)
  22.             animalInd++;
  23.         year -= 12;
  24.         colorInd++;
  25.     }
  26.     printf("Year of %s and %s\n", color[colorInd-1], animal[animalInd-1]);
  27.     getch();
  28.     return 0;
  29. }
Add Comment
Please, Sign In to add comment