What's new

Closed please pa correct sa code

Status
Not open for further replies.

enachris

Addict
Joined
Sep 17, 2015
Posts
15
Reaction
0
Points
65
Age
25
hello sa inyo first years student ako sa BSIT... pa correct po ng correct please.. gumawa ng program na pag eninter mo ang iyong birth month at birth date, it will determine your zodiac sign. C program gamit ko sa TC... salamat

#include<stdio.h>
#include<conio.h>
main()
{
int month,date;
clrscr();
printf("\n Enter your birth month and birth date");
scanf("%d",&month,date);
if ((month == 1 && date >= 20)(month == 2 && date <=18))
printf("\n Your zodiac sign is AQUARIUS");
else if (( month == 2 && date >= 19)( month == 3 && date <= 20))
printf("\n Your zodiac sign is PISCES");
else if (( month == 3 && date >= 21)( month == 4 && date <= 19))
printf("\n Your zodiac sign is ARIES");
else if (( month == 4 && date >= 20)( month == 5 && date <= 20))
printf("\n Your zodiac sign is TAURUS");
else if (( month == 5 && date >= 21 )( month == 6 && date <= 20 ))
printf("\n Your zodiac sign is GEMINI");
else if (( month == 6 && date >= 21 )( month == 7 && date <= 22 ))
printf("\n Your zodiac sign is CANCER");
else if (( month == 7 && date <= 23 )( month == 8 && date <= 22))
printf("\n Your zodiac sign is LEO");
else if (( month == 8 && date >= 23 )( month == 9 && date <= 22 ))
printf("\n Your zodiac sign is VIRGO");
else if (( month == 9 && date >= 23 )( month == 10 && date <= 22))
printf("\n Your zodiac sign is LIBRA");
else if (( month == 10 && date >= 23 )( month == 11 && date <= 21))
printf("\n Your zodiac sign is SCORPIO");
else if (( month == 11 && date >= 22 )( month == 12 && date <= 21))
printf("\n Your zodiac sign is SAGUITTARIUS");
else if (( month == 12 && date >= 22 )( month == 1 && date <= 19 ))
printf("\n Your zodiac sign is CAPRICORN");
else
printf("\n INVALID INPUT");
getch();
return(0);
}
 
Code:
#
#include<stdio.h>
#include<conio.h>
void main ()
{

    int month;

    int date;
    printf ("Enter your birth month as a number:");

    scanf ("% d", & month);

    if (month == 1)

        {

            printf ("\ nYou born in JANUARY \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac AQUARIUS \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac CAPRICORN \ n \ n");

        }

    else

    if (month == 2)

        {

            printf ("\ nYou born in FEBRUARY \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 20)

                    printf ("You Are the Zodiac PISCES \ n");

                    else

                        if (date <20)

                        printf ("You Are the Zodiac AQUARIUS \ n \ n");

        }

    else

    if (month == 3)

        {

            printf ("\ nYou born in MARCH \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac ARIES \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac PISCES \ n \ n");

        }

    else

    if (month == 4)

        {

            printf ("\ nYou born in APRIL \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac TAURUS \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac ARIES \ n \ n");

        }

    else

    if (month == 5)

        {

            printf ("\ nYou born in MEI \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac GEMINI \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac TAURUS \ n \ n");

        }

    else

    if (month == 6)

        {

            printf ("\ nYou born in JUNE \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 22)

                    printf ("You Are the Zodiac CANCER \ n");

                    else

                        if (date <22)

                        printf ("You Are the Zodiac GEMINI \ n \ n");

        }

    else

    if (month == 7)

        {

            printf ("\ nYou born in JULY \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 23)

                    printf ("You Are the Zodiac LEO \ n");

                    else

                        if (date <23)

                        printf ("You Are the Zodiac CANCER \ n \ n");

        }

    else

    if (month == 8)

        {

            printf ("\ nYou born in AUGUST \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 24)

                    printf ("You Are the Zodiac VIRGO \ n");

                    else

                        if (date <24)

                        printf ("You Are the Zodiac LEO \ n \ n");

        }

    else

    if (month == 9)

        {

            printf ("\ nYou born in SEPTEMBER \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 23)

                    printf ("You Are the Zodiac LIBRA \ n");

                    else

                        if (date <23)

                        printf ("You Are the Zodiac VIRGO \ n \ n");

        }

    else

    if (month == 10)

        {

            printf ("\ nYou born in OCTOBER \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 24)

                    printf ("You Are the Zodiac SCORPIO \ n");

                    else

                        if (date <24)

                        printf ("You Are the Zodiac LIBRA \ n \ n");

        }

    else

    if (month == 11)

        {

            printf ("\ nYou born in NOVEMBER \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 23)

                    printf ("You Are the Star sign Sagittarius \ n");
                    else
                        if (date <23)
            printf ("You Are the Zodiac SCORPIO \ n \ n");
        }
    else
    if (month == 12)
        {
     printf ("\ nYou born in DECEMBER \ n \ n");
            printf ("Please enter your date of birth:");
                    scanf ("% d", & date);
                    if (date> = 22)
                    printf ("You Are the Zodiac CAPRICORN \ n");
                    else
                        if (date <22)
printf ("You Are the Star sign Sagittarius \ n \ n");
        }
}
 
Code:
#
#include<stdio.h>
#include<conio.h>
void main ()
{

    int month;

    int date;
    printf ("Enter your birth month as a number:");

    scanf ("% d", & month);

    if (month == 1)

        {

            printf ("\ nYou born in JANUARY \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac AQUARIUS \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac CAPRICORN \ n \ n");

        }

    else

    if (month == 2)

        {

            printf ("\ nYou born in FEBRUARY \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 20)

                    printf ("You Are the Zodiac PISCES \ n");

                    else

                        if (date <20)

                        printf ("You Are the Zodiac AQUARIUS \ n \ n");

        }

    else

    if (month == 3)

        {

            printf ("\ nYou born in MARCH \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac ARIES \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac PISCES \ n \ n");

        }

    else

    if (month == 4)

        {

            printf ("\ nYou born in APRIL \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac TAURUS \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac ARIES \ n \ n");

        }

    else

    if (month == 5)

        {

            printf ("\ nYou born in MEI \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 21)

                    printf ("You Are the Zodiac GEMINI \ n");

                    else

                        if (date <21)

                        printf ("You Are the Zodiac TAURUS \ n \ n");

        }

    else

    if (month == 6)

        {

            printf ("\ nYou born in JUNE \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 22)

                    printf ("You Are the Zodiac CANCER \ n");

                    else

                        if (date <22)

                        printf ("You Are the Zodiac GEMINI \ n \ n");

        }

    else

    if (month == 7)

        {

            printf ("\ nYou born in JULY \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 23)

                    printf ("You Are the Zodiac LEO \ n");

                    else

                        if (date <23)

                        printf ("You Are the Zodiac CANCER \ n \ n");

        }

    else

    if (month == 8)

        {

            printf ("\ nYou born in AUGUST \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 24)

                    printf ("You Are the Zodiac VIRGO \ n");

                    else

                        if (date <24)

                        printf ("You Are the Zodiac LEO \ n \ n");

        }

    else

    if (month == 9)

        {

            printf ("\ nYou born in SEPTEMBER \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 23)

                    printf ("You Are the Zodiac LIBRA \ n");

                    else

                        if (date <23)

                        printf ("You Are the Zodiac VIRGO \ n \ n");

        }

    else

    if (month == 10)

        {

            printf ("\ nYou born in OCTOBER \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 24)

                    printf ("You Are the Zodiac SCORPIO \ n");

                    else

                        if (date <24)

                        printf ("You Are the Zodiac LIBRA \ n \ n");

        }

    else

    if (month == 11)

        {

            printf ("\ nYou born in NOVEMBER \ n \ n");

            printf ("Please enter your date of birth:");

                    scanf ("% d", & date);

                    if (date> = 23)

                    printf ("You Are the Star sign Sagittarius \ n");
                    else
                        if (date <23)
            printf ("You Are the Zodiac SCORPIO \ n \ n");
        }
    else
    if (month == 12)
        {
     printf ("\ nYou born in DECEMBER \ n \ n");
            printf ("Please enter your date of birth:");
                    scanf ("% d", & date);
                    if (date> = 22)
                    printf ("You Are the Zodiac CAPRICORN \ n");
                    else
                        if (date <22)
printf ("You Are the Star sign Sagittarius \ n \ n");
        }
}
thanks kuya.. try ko salamat ulit
 
flowchart ng?

hello yung pinost ko oki na yung pero sabi ng teacher ng dapat daw may
continue asking the user if he/she wants to test another input.

Sample Output:
Enter your birth month and birth date as a number: 08 16

Your zodiac sign is LEO

pa help namn po kung ano code ang gagamitin ko.
 
Dear enachris,

Since 2 years have passed since the last reply in this thread, I am locking it to prevent necroposting. Feel free to start a new thread or contact any forum staff if you want this to be reopened.

Thread closed.
 
Status
Not open for further replies.

Similar threads

Back
Top