#9871: 請問哪裡錯


chintan5311 (銘)

學校 : 新北市立新店高級中學
編號 : 50055
來源 : [114.34.86.248]
最後登入時間 :
2015-06-06 23:44:14
a003. 兩光法師占卜術 | From: [114.34.86.248] | 發表日期 : 2015-05-30 17:19

#include<stdio.h>

#include<stdlib.h>

int main()

{

    int M,D,S;

    do

    {

        printf("Enter Month:");

        scanf("%d",&M);

        printf("Enter Date:");

        scanf("%d",&D);

 

        if (M<=12&&D<=31){

            

            continue;

            

        }

        else{

            printf("ERRO");

            return 0;

            

        }

 

    }while (0);

    

        do{

            S=(M*2+D)%3;

            break;

    

    }while (1);

    {

        if (S==0) {

            printf("普通");

        }

        else if(S==1){

            printf("小吉");

        }

        else if(S==2){

            printf("大吉");

        }

    }

    

}

請高手指點 

 
#9953: Re:請問哪裡錯


jimmyy512 (Majitoo)

學校 : 新北市立淡水高級商工職業學校
編號 : 46229
來源 : [114.36.98.109]
最後登入時間 :
2017-07-07 13:10:37
a003. 兩光法師占卜術 | From: [114.42.202.24] | 發表日期 : 2015-06-28 12:18

#include <stdio.h>

#include <stdlib.h>

int main ()

{

int m,d,num;

while(scanf("%d %d",&m,&d)!=EOF)

{

num=(m*2+d)%3;

if(num>1)

printf("大吉\n");

else if(num>0)

printf("吉\n");

else

printf("普通\n");

}

}

 
ZeroJudge Forum