#include<stdio.h>
#include<conio.h>
int main()
{
int lastpday;
int lastpmonth;
int sexuald;
int ovu;
float circumference;
float size;
printf("enter your last period day : ");
scanf("%d",&lastpday);
printf("enter your last period month : ");
scanf("%d",&lastpmonth);
printf("enter your sexual day : ");
scanf("%d",&sexuald);
if(lastpday==18,19,20,21,22,23,24,25,26,27,28,29,30,31 && lastpmonth==1,3,5,7,8,10,12)
{
ovu=(lastpday+14)-31;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth+1);
}
else if(lastpday==17,18,19,20,21,22,23,24,25,26,27,28,29,30 && lastpmonth==4,6,9,11)
{
ovu=(lastpday+14)-30;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth+1);
}
else if(lastpday==15,16,17,18,19,20,21,22,23,24,25,26,27,28 && lastpmonth==2)
{
ovu=(lastpday+14)-28;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth+1);
}
else if(lastpday=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 && lastpmonth==1,3,5,7,10,11,12)
{
ovu=lastpday+14;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth);
}
else if(lastpday=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 && lastpmonth==4,6,8,9)
{
ovu=lastpday+14;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth);
}
else if(lastpday=1,2,3,4,5,6,7,8,9,10,11,12,13,14 && lastpmonth==2)
{
ovu=lastpday+14;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth);
}
getch();
return 0;
}
(c++)รบกวนดูให้หน่อยค่ะว่าผิดตรงไหน ทำไมมันทำงานแต่เงื่อนไขแรกอย่างเดียว
#include<conio.h>
int main()
{
int lastpday;
int lastpmonth;
int sexuald;
int ovu;
float circumference;
float size;
printf("enter your last period day : ");
scanf("%d",&lastpday);
printf("enter your last period month : ");
scanf("%d",&lastpmonth);
printf("enter your sexual day : ");
scanf("%d",&sexuald);
if(lastpday==18,19,20,21,22,23,24,25,26,27,28,29,30,31 && lastpmonth==1,3,5,7,8,10,12)
{
ovu=(lastpday+14)-31;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth+1);
}
else if(lastpday==17,18,19,20,21,22,23,24,25,26,27,28,29,30 && lastpmonth==4,6,9,11)
{
ovu=(lastpday+14)-30;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth+1);
}
else if(lastpday==15,16,17,18,19,20,21,22,23,24,25,26,27,28 && lastpmonth==2)
{
ovu=(lastpday+14)-28;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth+1);
}
else if(lastpday=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17 && lastpmonth==1,3,5,7,10,11,12)
{
ovu=lastpday+14;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth);
}
else if(lastpday=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 && lastpmonth==4,6,8,9)
{
ovu=lastpday+14;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth);
}
else if(lastpday=1,2,3,4,5,6,7,8,9,10,11,12,13,14 && lastpmonth==2)
{
ovu=lastpday+14;
printf("ovulation is %d",ovu);
printf("\t/%d",lastpmonth);
}
getch();
return 0;
}