# C# : Calculating Age with Zodiac Sign

1
101

If you find it hard to calculate the age of your relative or anyone else close to you. Even its just a simple arithmetic, it still makes you feel dizzy to know someone’s age just by its year. This tutorial will help you on how to calculate age with its corresponding zodiac sign. Now, you don’t have to google what’s your zodiac sign or your friends’ because this method will let you know about it after calculating your age. This is not just useful but its also kinda fun.

### Let’s begin:

Open Microsoft Visual Studio and create a new windows form application. after that, do the form just like this.

After setting up the form, go to the solution explorer and hit the “view code” to fire the code editor.

In the code editor, declare and initialize theÂ variablesÂ that you’re going to use in public.

```//SET AN ARRAY VARIABLE TO STORE THE VALUE OF THE ZODIAC SIGNS ON IT.
string[] Zodiac_Sign = new string[12]{"Aries", "Taurus", "Gemini", "Cancer","Leo", "Virgo", "Libra",
"Scorpio", "Sagittarius","Capricorn"ca, "Aquarius", "Pisces"};
//SET A VARIABLE TO REPRESENTS YOUR AGE.
int age;```

After that, go back to the design view, double-click the “calculate” button and do the following code in the method.

``` //SET THE STRING VARIABLE REPRESENT A FORMATED DATETIMEPICKER TO THE NAME OF THE MONTHS.
string months = dtpDateBirth.Value.Date.ToString("MMMM");
//SET THE INTEGR VARIABLE REPRESENT A FORMATED DATETIMEPICKER TO A VALUE OF THE DAY.
int days = int.Parse(dtpDateBirth.Value.Date.ToString("dd"));
//CALCULATING THE INTERVAL BETWEEN THE DATE OF BIRTH AND THE END OF THE DATE.
age = dtpEndDate.Value.Year - dtpDateBirth.Value.Year;
//CLEARING THE LISTBOX.
listBox1.Items.Clear();
//ADDING THE VALUE OF THE AGE IN THE LISTBOX TAHT YOU HAVE CALCULATED.

switch (months)
{
case "January":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "February":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "March":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "April":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "May":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "June":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "July":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "August":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "September":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "October":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "november":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
case "December":
if (days >= 1 && days <= 19)
{
}
else
{
}
break;
};```

### Output:

For all students who need a programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :
Email â€“ jannopalacios@gmail.com
Mobile No. â€“ 09305235027 â€“ tnt

(Visited 148 times, 1 visits today)

#### 1 COMMENT

1. I am no longer positive the place you’re getting your information, but
good topic. I needs to spend a while learning much more or understanding more.
Thank you for fantastic information I used to be in search
of this info for my mission.