This code tells us about our birthstone or zodiac sign, many of us don’t know what is our zodiac sign or even what is our birthstone. Birthstone is a gemstone that represents a person’s birth month, and zodiac is an area of the sky centred upon the ecliptic.
There are 12 types of zodiac signs and birthstones, and this code helps the users to know what are their zodiac sign and birthstone by just giving their date of birth and month of birth as input and the code finds out the rest.
The code starts with including of the header files, that is, ‘stdio.h’ and ‘conio.h’.
After including the header files the code enters the main function where the code asks the user to enter his/her date of birth and then birth month number and the information is stored in the variables ‘date’ and ‘ch’.
printf("ENTER DATE OF BIRTH AND THEN MONTH NO.");
Then the code enters the main process where it checks the information given by the user with the information stored in the code and accordingly gives the output.
If conditions is given a range and it checks if the date of birth lies within that range and also if the month of birth is equal to the months in that range.
For example: if the user enters as date of birth as ‘19th’ and month of birth as ‘10’ , that is, October then it will check with all the given if condition and as one of them will satisfy so it will give an output saying “you are an LIBRA and your birthstone is CHRYSOLITE”. The birthstone is also displayed with the same given piece of information.
if (((date>=21) && (ch==3)) || ((date<=20 ) && (ch==4 )))
printf("YOU ARE A ARIES AND YOUR BIRTHSTONE IS BLOODSTONE");
if (((date>=21) && (ch==4)) || ((date<=21 ) && (ch==5 )))
printf("YOU ARE A TAURUS AND YOUR BIRTHSTONE IS SAPPHIRE");
if (((date>=22) && (ch==5)) || ((date<=21 ) && (ch==6 )))
printf("YOU ARE A GEMINI AND YOUR BIRTHSTONE IS AGATE");
if (((date>=22) && (ch==6)) || ((date<=22 ) && (ch==7 )))
printf("YOU ARE A CANCER AND YOUR BIRTHSTONE IS EMERALD");
if (((date>=23) && (ch==7)) || ((date<=22 ) && (ch==8 )))
printf("YOU ARE A LEO AND YOUR BIRTHSTONE IS ONYX");
Thus ends our code and the user will get the desired output, the code is simple to understand all it needs is conditions about the zodiac sign and birthstone and if you understand those conditions the logic of the program becomes really simple. Download: C Program: Knowing your Zodiac Sign and Birthstone
Download C Program: Knowing your Zodiac Sign and Birthstone