Ad

Chapter - 3: The Decision Control

Write a program that receives month and date of birth as input and prints the corresponding Zodiac sign based on the following table. (date format: dd/mm) Capricorn : 22/12 - 19/01 Aquaris : 20/01 - 17/02 Pisces : 18/02 - 19/03 Aries : 20/03 - 19/04 Taurus : 20/04 - 20/05 Gemini : 21/05 - 20/06 Cancer : 21/06 - 22/07 Leo : 23/07 - 22/08 Virgo : 23/08 - 22/09 Libra : 23/09 - 22/10 Scorpio : 23/10 - 21/11 Sagittarius : 22/11 - 21/12


Ad
G
Sections
11
Exercises
#include<stdio.h>
#include<conio.h>
int main()
{
	int d,m;
	
	printf("\nEnter the data and month of birth : ");
	scanf("%d%d", &d, &m);
	
	printf("\nYour Zodiac is : ");
	
	if(m == 12 && d >= 22 || m == 1 && d <= 19)
		printf("Capricorn.");
	
	if(m == 1 && d >= 20 || m == 2 && d <= 17)
		printf("Aquaries.");
		
	if(m == 2 && d >= 18 || m == 3 && d <= 19)
		printf("Pisces");
	
	if(m == 3 && d >= 20 || m == 4 && d <= 19)
		printf("Aries");
		
	if(m == 4 && d >= 20 || m == 5 && d <= 20)
		printf("Taurus");
		
	if(m == 5 && d >= 21 || m == 6 && d <= 20)
		printf("Gemini");
		
	if(m == 6 && d >= 21 || m == 7 && d <= 22)
		printf("cancer");
		
	if(m == 7 && d >= 23 || m == 8 && d <= 22)
		printf("Leo");
		
	if(m == 8 && d >= 23 || m == 9 && d <= 22)
		printf("Virgo");
		
	if(m == 9 && d >= 23 || m == 10 && d <=22)
		printf("Libra");
		
	if(m == 10 && d >= 23 || m == 11 && d <= 21)
		printf("Scorpio");
		
	if(m == 11 && d >= 22 || m == 12 && d <=21)
		printf("Sagittarius.");
	
	getch();
	return 0;
}
Ad

© 2024 Garbage Valuegarbage value logo