Advertisement
obernardovieira

(New) Get Zodiac Sign (with matrices)

Nov 24th, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.49 KB | None | 0 0
  1. signsName = {'Capricorn','Aquarius','Pisces','Aries','Taurus','Gemini','Cancer','Leo','Virgo','Libra','Scorpio','Sagittarius'};
  2. signsDate = [20;19;21;20;21;21;23;23;23;23;22;22];
  3.  
  4. birthday = input('Insert your birthday date in format dd-mm: ', 's');
  5. dm = strsplit(birthday, '-');
  6. day = str2num(cell2mat(dm(1,1)));
  7. month = str2num(cell2mat(dm(1,2)));
  8.  
  9. if day < signsDate(month, 1)
  10.     fprintf('Your sign is %s\n', signsName{month});
  11. else
  12.     fprintf('Your sign is %s\n', signsName{month+1});
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement