问答详情
源自:5-1 编程练习

各位大佬,这样子不可以吗

public class HelloWorld {

    public static void main(String[] args) {

        int score = 58; 

        int count = 0;

        System.out.println("加分前成绩:"+score);

        if(score<60)

        {

            

        while(score!=60)

        {

        count++;

        score=score+count;

        }

        System.out.println("加分后成绩:"+score);

    

        System.out.println("共加了:"+count+"次!");

        }

        else{

            System.out.println("不用加");

        }

        


提问者:qq_心跳_20 2018-10-06 20:33

个回答

  • 可以吧
    2018-11-15 20:00:48

    后面的大括号少了两

  • 慕尼黑0191331
    2018-10-06 23:00:10

    score=score+count; 换成 score++; 就OK了