Home  >  Q&A  >  body text

What's wrong?

<?PHP

$chenji=rand(0,100);

if($chenji>=0 &&$chenji<60){

echo'No Passed';

}elseif ($chenji>=60 && $chenji<70)}

echo'Passed, have to work hard';

}elseif($chenji> ;=70 && $chenji<80){

echo'Very good';

}elseif($chenji>=80 && $chenji<90){

echo 'There is hope for Tsinghua University';

}elseif($chenji>=90 && $chgenji<100){

echo'You have no hope in this life';

}esle($chenji=100){

echo'There is no more hope';

}

?>

喂。喂。2432 days ago1485

reply all(9)I'll reply

  • A0专汽定制

    A0专汽定制2019-03-05 14:08:37

    <?php

    $chengji=rand(0,100);

    echo $chengji;

    if($chengji<60){

    echo 'Failed';

    }elseif($chengji>=60&&$chengji<80){

    echo 'Although passing, still need to work hard';

    }elseif ($chengji>=90&&$chengji<100){

    echo 'Continue to maintain excellent results';

    }else{

    echo 'Incorrect input';

    }

    ?>


    reply
    0
  • ~多多~V504515363

    ~多多~V5045153632018-02-21 19:51:15

    If you write code like this, if it is at work, will it be indented at the minimum? {This can all be written incorrectly. Chinese and English semicolons do not distinguish. Else can also be incorrect. With your

    attitude towards work, you should go home and farm


    <?php

    //Please enter your php code


    $chenji=rand(0,100);

    echo $ chenji ;

    if($chenji >= 0 && $chenji < 60){

    echo 'failed' ;

    }elseif ($chenji >= 60 && $chenji < 70){

    echo 'You passed the test, you have to work hard' ;

    }elseif($chenji >= 70 && $chenji < 80){

    echo 'Very good' ;

    }elseif($chenji >= 80 && $chenji < 90){

    echo 'There is hope for Tsinghua University';

    }elseif($chenji >=90 && $chgenji < 100){

    echo 'You have no hope in this life' ;

    }else {

    echo 'There is no more hope' ;

    }

    ?>



    reply
    0
  •         我不是你的肖奈

            我不是你的肖奈2018-01-23 15:47:01

    $chengji=rand(0,100);
    echo $chengji;
    if($chengji<60){
    echo 'failed';
    }else if ($chengji<70) {
    echo 'You passed, you have to work hard';
    }else if($chengji<80){
    echo 'Very good';
    }else if($chengji<90){
    echo 'There is hope for going to Tsinghua University';
    }else if($chengji<100){
    echo 'You have no hope in this life';
    }else{
    echo 'There is even less hope ';
    }

    reply
    1
  •         我不是你的肖奈

            我不是你的肖奈2018-01-23 15:46:46

    Version:1.0 StartHTML:0000000128 EndHTML:0000005061 StartFragment:0000000128 EndFragment:0000005061 SourceURL:about:blank$chengji=rand(0,100);
    echo $chengji;
    if($chengji<60){
    echo 'failed';
    }else if ($chengji< 70){
    echo 'You passed, you have to work hard';
    }else if($chengji<80){
    echo 'Very good';
    }else if($chengji<90){
    echo 'There is hope for going to Tsinghua University';
    }else if($chengji<100){
    echo 'You have no hope in this life';
    }else{
    echo 'Nothing more I hope';
    }

    reply
    1
  • 森

    2018-01-23 10:51:13

    <?PHP


    ##$chenji=rand(0,100);

    if($chenji>=0 &&$chenji<60){

    echo 'Failed';

    }elseif ($chenji>=60 && $chenji<70){

    echo 'Passed, work hard';

    }elseif($chenji>=70 && $chenji<80){

    echo 'Very good';

    }elseif($chenji>=80 && $chenji<90 ){

    echo 'There is hope for Tsinghua University';

    }elseif($chenji>=90 && $chgenji<100){

    echo 'You have no hope in this life ';

    }else{

    echo 'There is no hope anymore';

    }

    ?>



    reply
    0
  • 森

    The last else is written incorrectly, and there is no need to add conditions. elseif ($chenji>=60 && $chenji<70)} The following brackets are written backwards. ;Switch to English

    · 2018-01-23 10:53:41
            我不是你的肖奈

    $chengji=rand(0,100); echo $chengji; if($chengji<60){ echo 'failed'; }else if ($chengji<70){ echo 'You passed the test, you have to work hard'; }else if($chengji<80){ echo 'very good'; }else if($chengji<90){ echo 'There is hope for Tsinghua University'; }else if($chengji<100){ echo 'You have no hope in this life'; }else{ echo 'There is no more hope'; }

            我不是你的肖奈 · 2018-01-23 15:46:22
  • nike

    nike2018-01-23 01:05:45

    1, many Chinese semicolons need to be changed to English, only English symbols can be used in programming

    2, the last else word is written wrong

    3, after the last else is If you directly connect the curly brackets, you are not allowed to add parentheses to add conditions after it. It does not comply with the grammatical specifications

    4. There is no need to add conditions for the last else here. If none of the above are met, it can only be $chenji =100.

    reply
    0
  • 喂。

    The point of the question is that 92 will fail under random circumstances. No matter any number, it will fail...

    喂。 · 2018-01-23 01:17:50
    nike

    Just replace $chenji=rand(0,100); with $chenji = 92; and see what the result is! The last variable name of $chgenji<100 is typed incorrectly.

    nike · 2018-01-23 01:25:56
    喂。

    Still the same. How could this happen?

    喂。 · 2018-01-23 18:29:38
  • Cancelreply