#include <stdio.h>
#define p printf
#define s scanf
int year, month, age, currentdate, currentmonth, birthmonth, birthdate,
numofmonths, daysalive;
main ()
{
p("Welcome to my age calculating program!\n");
p("The program will calculate the number of days you have live since birth.\n");
p("Note: The result will not be exact because of leap years.\n");
p("Input age: ", age);
s("%d;", &age);
{
for (currentmonth = 1;
currentmonth <= 12;
currentmonth++)
p("%d \n", currentmonth);
}
p("Input current month: ", currentmonth);
s("%d;", ¤tmonth);
p("Input current date: ", currentdate);
s("%d", ¤tdate);
p("Input birth month: ", birthmonth);
s("%d", &birthmonth);
p("Input birth date: ", birthdate);
s("%d", &birthdate);
if (currentmonth >= birthmonth);
{
daysalive = (age * 365) + (currentmonth - birthmonth) * 30 + (30 - birthdate) + currentdate;
p("The number of days you have lived is about %d", daysalive);
s("%d", daysalive);
}
else
(currentmonth <= birthmonth);
{
daysalive = (age * 365) + (12 - birthmonth) * 30 + (currentmonth * 30) + (30 - birthdate) + currentdate;
p("The number of days you have lived is about %d", daysalive);
s("%d", daysalive);
}
}
I checked everything, still it has errors.
It says: Error: expected primary-expression before "else''
Error: expected ';' before "else"
Could you please help? That's my only problem. I need it to work, as in both conditions.