Write a C program that receives month and date of birth as input and prints the corresponding Zodiac sign or Astrological sign or Sun Sign based on the following table:
| Sun Sign | From – To |
|---|---|
| Capricorn | December 22 – January 19 |
| Aquarius | January 20 – February 17 |
| Pisces | February 18 – March 19 |
| Aries | March 20 – April 19 |
| Taurus | April 20 – May 20 |
| Gemini | May 21 – June 20 |
| Cancer | June 21 – July 22 |
| Leo | July 23 – August 22 |
| Virgo | August 23 – September 22 |
| Libra | September 23 – October 22 |
| Scorpio | October 23 – November 21 |
| Sagittarius | November 22 – December 21 |
Related Read:
else if statement in C
Relational Operators In C
Logical Operators In C
Logic To Display Zodiac Sign for Given Date of Birth
Example, for Sun sign Capricorn, date lies between December 22 – January 19. So using &&(AND) and ||(OR) operators:
(month == 12 && day >= 22) || (month == 1 && day

Expected Output for the Input
User Input:
Enter your birth month(1-12)
4
Enter your birth day
22
Output:
Your Zodiac Sign based on your Birth date is Taurus
Video Tutorial: C Program To Display Zodiac Sign for Given Date of Birth
Source Code: C Program To Display Zodiac Sign for Given Date of Birth
#include
int main()
{
int m, day;
printf("Enter your birth month(1-12)\n");
scanf("%d", &m);
printf("Enter your birth day\n");
scanf("%d", &day);
if( (m == 12 && day >= 22) || (m == 1 && day = 20) || (m == 2 && day = 18) || (m == 3 && day = 20) || (m == 4 && day = 20) || (m == 5 && day = 21) || (m == 6 && day = 21) || (m == 7 && day = 23) || (m == 8 && day = 23) || (m == 9 && day = 23) || (m == 10 && day = 23) || (m == 11 && day = 22) || (m == 12 && day
Output 1:
Enter your birth month(1-12)
6
Enter your birth day
1
Your Zodiac Sign based on your Birth date is Gemini
Output 2:
Enter your birth month(1-12)
9
Enter your birth day
1
Your Zodiac Sign based on your Birth date is Virgo

For list of all c programming interviews / viva question and answers visit: C Programming Interview / Viva Q&A List
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert
