1 like 0 dislike
10.5k views

Write a program to find your zodiac sign. The program will take your date of birth as an input (YYYY/MM/DD) and output your zodiac. You can find information about zodiac here.

Example:

Input:

Input your birthday (YYYY/MM/DD):
1999/6/2

Output:

Your zodiac is Gemini

 

Input:

Input your birthday (YYYY/MM/DD):
1996/10/3

Output

Your zodiac is Libra
[Exercise] Coding (C) - asked in Chapter 3: Branching, Looping and Functions by (5.2k points)
ID: 28184 - Available when: Unlimited - Due to: Unlimited

edited by | 10.5k views
0 0
should I write all zodiac?

23 Answers

1 like 0 dislike
Hidden content!
*** *** * * * *
* *** ** * * **

int main(int argc, char *argv[]) {
* ** *** * int y, m, d;
* ** *
* * ** *** ** * * * *** your birthday * * ** * ** * **
** ** * * **
*** *** * * ** * * **** ** * ** * *** * * * * ** *
* * *
* ** ***** ** if(m == 1){
**** * ** ** * **** * ** if(d ** * 20 ** * * d *** 0)
*** **** ** * * *** *** * * ** * ****** * * **** ** zodiac sign is * * * * ** *
* * * * * **** *** ** else if(d * *** 20 ** * * * d * ** ** 31)
****** ** ** * ***** * ** * * * * *** * * * ** * zodiac sign is * * * * ** *
** * * * * * * else
* ** ** * * **** ** *** * * * ** * * ******* * *** ** *** * **
** * * * ** }
** * else if(m == 2){
***** *** * * * ** * *** if(d < 19 * * ** * ** d > 0)
** ** * * * ** **** * ** * * * * * * * zodiac sign is * ** **
** * **** * * * **** else if(d * * ** 19 * ** d ****** 28)
* * ** ** * *** ** * ** * ***** *** ***** zodiac sign is ** * *
* * * * ***** *** **** * else
*** ** * * ** * * ** * * * ** ** * ** ** **** * * * ** **
** * *** ** }
* * ** ** else if(m == 3){
* ** * * **** ****** if(d ** * * 21 * *** * ** d > 0)
******** * ** * * * *** * ** ** *** * * *** * zodiac sign is * ** * **
* * * * * * * *** else if(d * ** 21 * * * ******** d 31)
* * ** ******** ** * ** * * * ** zodiac sign is * *** * ***
*** * *** * * * * else
* * * * * ** * * * * * ***** * *** *** ** *** * ********** ** * *** *** ***
*** ** ** }
** * *** * *** else if(m == 4){
* * * * * * *** ** * if(d ** * 20 * * ** ** ** d ** ** 0)
****** * * * *** ** ** * * * * *** * * * zodiac sign is * * *
** ** * * * *** * ** * else if(d * * 20 ** d * 30)
**** ** * ***** * * ** * * * * ** ****** * zodiac sign is *** * ***
** * * * * * *** ** ***** else
*** * * * ** * * * ** ** * ** * ** * ** * *** *** * ** ** *** ** * * *
* * ***** ** }
* ** ** * ** * * else if(m == 5){
* * ** *** ** * * ** if(d * * ** 21 *** * ** d > 0)
* * **** *** ** * * * * *** * * zodiac sign is * **** *
** ** * * * * ** * else if(d *** * 21 **** d * 31)
** ** * * * *** * *** * * * * * ** * * *** zodiac sign is ** * * ***
* ** * * * * * else
*** *** *** * *** * ** ** * * * ** * ** * *** ***** * * *** ** **
* ** * * * }
** else if(m == 6){
** *** * ** ** ** *** ****** if(d < 21 * * d > 0)
****** *** * * * * * * ** **** * * * ** ** ** zodiac sign is ** * *
** ** * ******** * * * * * else if(d * *** 21 **** * **** d ** ** 30)
* * ** *** * * ** *** *** * * * * * zodiac sign is *** * *
* **** *** * * **** ** ** else
* * ** * *** ** * * ** ** *** * * * * * * ******* * *** * * ** ** * * *
* * ** * * }
* ** ** *** * * else if(m == 7){
** * *** * * *** if(d * ** * 23 * * * *** d * ** * 0)
** * * * ** ***** * ** * * * *** * *** * * * zodiac sign is * *** **** **
* ** * * ** ** ** * ** * else if(d * *** 23 *** * * * d * 31)
* *** * ** ** ** ** * * * * * * ** * zodiac sign is ** *
* * **** ** * ** else
* ** *** * * ** ** ****** * * * ** **** * * ** ** **** * * * * * ***
* * * }
* * * *** * else if(m == 8){
** ** * *** * **** ** * if(d * * 23 *** ***** d * ** 0)
* * * ** ** * ** ** * * * * * ** * zodiac sign is *
** ** * ** * * ** else if(d ***** 23 ** ** *** d ** * * 31)
** ** ** * * * * * *** * * * * * * * * * * zodiac sign is * * ****
* * ** * ****** * *** ** else
** * * * * * * ** *** * * **** * *** ** * * * *** * ** *** * ** *** * * *** * *
** * ** *** }
* * ** else if(m == 9){
***** * * ** * **** * * *** if(d * * * 23 ** * d * ** 0)
** * ** * ** * * *** * * ***** *** zodiac sign is * ****** *** *
*** ** * ** * * * * else if(d * 23 *** * * * d ** 30)
* *** ** **** ** ** * * * * zodiac sign is ** * * **
* * * **** ** * * * else
** * * * * ** ** * * * * *** * ** **** ** ** *** *** *** * * *** * * **** **
*** *** }
*** * * else if(m == 10){
** * * * * ***** if(d *** 23 * * ** **** d *** 0)
******** ** ***** * *** * * * * ** * ** * * *** * zodiac sign is * * * * **
* ** **** ** ** * else if(d * ** ** 23 ** *** d * 31)
* ** * ** ** ** ***** ** ** * * *** *** ** zodiac sign is * * *** *
* *** * * *** *** ***** ** ***** else
* * * ** *** ** * * ***** ** * * * * ** ** ** **** ** * * ** * * *** * *
* * **** }
* *** *** ** else if(m == 11){
** **** * * * * if(d * * 22 *** *** * ** d ** 0)
* ** * ** **** * *** ** ** ** *** * * ** zodiac sign is ** **
** * * * * *** * else if(d ** * 22 * * * * * * d **** ** 30)
** * ** * * * ** * * ** * * * *** ** ** * ** * * zodiac sign is ** ******** *
** * * * * ***** * else
** ** * * * ** * * ** * * ** ** ** * *** ** * * ** ** ***** ** *** * * ***** * * *
** * * }
* * * * * * else if(m == 12){
* **** **** * ** **** ** if(d * * 22 *** * d **** 0)
** * * * * * ** ** * *** ** ** ***** * * * zodiac sign is * * * * ***
** *** ** *** **** else if(d 22 * * ***** d * ** * 31)
* ***** ** *** ** **** * *** * * * * ** *** zodiac sign is * * * **
* *** ** ** ***** * **** else
* * *** * *** * ** * ****** * * *** * * * * * ** * * ** ** ** * ** ***
* * * }
**** * * * else
* * * * * ** * ** * * * *** * * **
**** *** ** ** return 0;
}
50/100 answered by (269 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
1 like 0 dislike
Hidden content!
#include * * ** *** * *
#include *** * * ***

/* run this program using the console pauser or aD your own getch, * ** **** * * **** ** or input loop */

int main(int argc, char *argv[]) {
* * *** * int Y, M, D;
* ***   printf ****** input your Birthday * * *** = *** * * * ***
* *** ** scanf * * * / %d / * ** * * * ** ** ***
*** * * ** ** if * ** **** **** *** * *** (M==3)) || *** * ) * ** ** * (M==4 ))){ *****
* ****** * ** **** * * * * * *** ** * * ** zodiac is ** **
** ** * * ** * ****
**** ** * * * * * * * * * if ** * * *** *** ** **** (M==4)) || * * ) * * ** * (M==5 ))){ * * **
* *** * * * * * * ****** *** * * * zodiac is * * * * *
** ** * ****** **
** * *** * * *** if **** **** * * * * ** ** *** (M==5)) || * *** ) * * * (M==6 ))){  
* * * ** * ****** ** * * ** **** ** *** ** zodiac is ** ** **
* * * **** * *
*** * * *** ****** if *** * * *** *** * (M==6)) || *** ** ) * ** * (M== 7 ))){  
** *** * ** ** * ** *** * * ** *** * * got * * * *
****** * ** **** **
* * ** *** ** ** * * ** if **** * * * * ** *** (M==7)) || * * *** * ) ***** *** (M == 8 ))){ ** ***
** * * *** ** ** *** * *** * zodiac is * * * *
***** * * *** ** **
* * * * * ** ** ** * ***** if ** * *** *** **** **** ** * (M== 8)) || *** * * ** ) * *** * ** * (M== 9 ))){ **** *
* * * ** * * ** * * **** * * ** *** * * zodiac is * ** *
* ** ** * * * **
* ** ** ****** * * if ** **** * ** * * * (M== 9)) || * ** * ) * ** (M==10 ))){  
* ** ****** **** ** ***** * **** ** ** * ** zodiac is *** * *
** * * ** ** *
* **** * *** * * * *** * * ** ** if **** ** * ** * * *** * (M==10)) || * * ***** ) * * *** (M==11 ))){  
* ** ** * * **** * * ** * *** * * *** * * zodiac is ** * * ***
*** **** * ** * *
** * **** * * * * **** *** if ** * *** ** * ** * *** * ** * * (M==11)) || * ****** ) * * * * (M==12 ))){ * * *
* * *** * * * * **** * * * * ** * * zodiac is ** ** * ** *
* * ** * * * *** *
* ** ** * ** if * ** * * ** ** (M==12)) || * * ) * ** * * (M==1 ))){  
** * ** *** * *** ** **** * * * * * *** * zodiac is * ** * ** *
**** ** *** ***** *
* * * * * * *** ** if *** * *** * ** * ** (M==1)) || * ** ) * ** *** * (M==2 ))){ * *
*** **** * * * ** * *** ** ** **** *** * ** zodiac is * * *******
*** * * * * **** **
* * * **** ** ** **** * if ** ** **** * * * (M==2)) || * * ** * (M==3 ))){ ** * *
*** * **** * * * *** ** ** zodiac is ** **
** *** ** *** * **
* * * ** ** *** **** ** ***
* ** ** * *** * * zodiac is Teddy * * *
**** *** return 0;
}
100/100 answered by (268 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
I'm getting tired of you
0 0
printf("You got Cancer");
This is not correct bud

and you need period (.) at the end of each sentence

printf ("please input your Birthday (YYYY/MM/DD) =  ");
and you need to delete this line

There is no blank space in input
1999/6/2, not like this 1999 / 6 / 2
0 0
Jokes only lahh.

Okay, fine.

Whyy?? How will the user know what to input?? A program must be user friendly, right? :)

You can type your birthday without blank space. Try it. Seriously.
0 0
because it's how you work with online judge, get the exact right output
0 0
The judge needs Jesus
0 0
actually your condition is not 100% correct
if (((D>=21)  && (M==3)) || ((D<=20 ) && (M==4 )))
what if the user accidentally input 1996/03/50?
It will print "Your zodiac is Aries."
while in fact, the date is not even exists.
0 0
#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or aD your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    int Y, M, D;
    printf ("please input your Birthday (YYYY/MM/DD) =  ");
    scanf ("%d / %d / %d", &Y, &M, &D);
    if (((D>=21)  && (D<=31) && (M==3)) || ((D<=20 ) && (D<=31) && (M==4 ))){  
      printf("Your zodiac is Aries");
   }
    else if (((D>=20)  && (D<=30) && (M==4)) || ((D<=20 ) && (D<=31) && (M==5 ))){  
      printf("Your zodiac is Taurus");
   }
    else if (((D>=21)  && (D<=31) && (M==5)) || ((D<=20 ) && (D<=30) && (M==6 ))){  
      printf("Your zodiac is Gemini");
   }
    else if (((D>=21)  && (D<=30) && (M==6)) || ((D<=22 ) && (D<=31) && (M== 7 ))){  
      printf("You got Cancer");
   }
    else if (((D>=23)  && (D<=31) && (M==7)) || ((D<=22 ) && (D<=31) && (M == 8 ))){  
      printf("Your zodiac is Leo");
   }
    else if (((D>=23)  && (D<=31) && (M== 8)) || ((D<=22 ) && (D<=30) && (M== 9 ))){  
      printf("Your zodiac is Virgo");
   }
    else if (((D>=23)  && (D<=30) && (M== 9)) || ((D<=22 ) && (D<=31) && (M==10 ))){  
      printf("Your zodiac is Libra");
   }
    else if (((D>=23)  && (D<=31) && (M==10)) || ((D<=21 ) && (D<=30) && (M==11 ))){  
      printf("Your zodiac is Scorpio");
   }
    else if (((D>=22)  && (D<=30) && (M==11)) || ((D<=21 ) && (D<=31) && (M==12 ))){  
      printf("Your zodiac is Sagittarius");
   }
    else if (((D>=22)  && (D<=31) && (M==12)) || ((D<=19 ) && (D<=31) && (M==1 ))){  
      printf("Your zodiac is Capricorn");
   }
    else if (((D>=20)  && (D<=31) && (M==1)) || ((D<=18 ) && (D<29) && (M==2 ))){  
      printf("Your zodiac is Aquarius");
   }
    else if (((D==29) && (M==2)) || ((D<=20) && (D<=31) && (M==3 ))){  
      printf("Your zodiac is Pisces");
   }
    else
   printf("Your zodiac is Teddy Bear");
    return 0;
}
0 like 0 dislike
Hidden content!
#include * * * *
* * ** ** * **** ***

int main()
{
**** * * * ** * * * y, m, d;

** ***** ** ** ** * * **** * * * * *** * ** ** *** *** *** * * *
* * * *** * * * * * * ** zodiac is * * * *

* ***** ** * * * * * * == 1 * ** d * * 20 **** * d <= 31) || (m == 2 ** ** * ** d > 0 * **** d * ***** 18))
* * * *** ** *** **** * * * * * * ** ** ** * *** ** * **
** * * * * ** ** *** if((m == 2 ** * * d >= 19 * * * ** ** d * 29) || (m == 3 * *** ** d > 0 * **** * * d * 20))
* ** **** * ** * * *** * **** **** * * *** *** **** **
** ** * * ***** ***** if((m == 3 * * ** d * *** 21 *** ** *** d ** ** 31) || (m == 4 ***** d > 0 ** ** * d <= 19))
* * * ** ** ** ** ** ** * * ** *** * * *** *** * *
* ***** * * * ** ** * if((m == 4 ** * * ** ** d 20 * **** * * d *** 30) || (m == 5 * * ** *** d > 0 ** * * d *** 20))
* *** * * * * ** * **** ** ** * ** ** **** * * * *** * * ** *** * * * *
* ** * ** ** *** * ** if((m == 5 ** * ** * d ** * 21 *** * * * d ***** 31) || (m == 6 ** * d > 0 * ** ** ** d * * *** 20))
* ** *** * **** ** * * ** ** **** * ** ** * * * *
* * * * *** ** **** **** if((m == 6 *** *** d **** 21 * * * d * * 30) || (m == 7 * ** * * d > 0 * * * * ** d ** ** 22))
**** * ** *** * * * ** * * * ******** *** * ** * * * * * *
* ** * * * ****** * *** if((m == 7 * * * * d >= 23 ***** d 31) || (m == 8 * ** * * * d > 0 ** * *** d ** * 22))
* * ***** ****** * ** ** ****** *** * * ** * * *
** * ** *** * if((m == 8 * * * d * * * 23 ** * * *** d * * 31) || (m == 9 **** ** d > 0 * *** ** ** d * 22))
*** * *** ***** ** **** * ** ***** *** * ** * *** ** * ***** **
* * * * *** * * *** * * ** if((m == 9 ** * * * * d * * * 23 * * ** d * * ** 30) || (m == 10 ** ** ** d > 0 ** * ** ** * d * * ** 22))
** ** ** **** * * * * * * *** *** **** *** ** * * * ** ***
* * * ** ** ** if((m == 10 * **** * * d * *** 23 ** ** d **** 31) || (m == 11 *** * * d > 0 **** * * * d * ** * 21))
* *** *** ** ***** * * ****** ** * ** * *** * *** *
***** * * **** * if((m == 11 * * ** ** * d * 22 **** **** * d <= 30) || (m == 12 * ** * d > 0 * * **** d * 21))
* * * * * * * * **** * * * * * * *** * * * ** * * ** ** ** ** * *
* *** *** * * * ** * *** if((m == 12 * *** d * *** 22 **** * d ** * ** 31) || (m == 1 ** *** ** d > 0 * * * * d * ** ** 19))
** * * *** * ** * * ** *** * ** ** * ****** * * * **** ** *** * ******

** ********** * * ***** ** 0;
}
answered by (5.2k points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.243.70
©2016-2026

Related questions

0 like 0 dislike
14 answers
[Exercise] Essay (Open question) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30244 - Available when: Unlimited - Due to: Unlimited
| 4.1k views
0 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30241 - Available when: Unlimited - Due to: Unlimited
| 8.7k views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Oct 27, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 29618 - Available when: Unlimited - Due to: Unlimited
| 7.7k views
1 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 20, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 28130 - Available when: Unlimited - Due to: Unlimited
| 9.1k views
12,783 questions
183,442 answers
172,219 comments
4,824 users