pages:
  • 1
saman SAYS
    why this code is presentation error?

    cout<<"A has "<<C[i][0]<<" points. B has "<<C[i][1]<<" points.";
    cout<<endl;
cout<<endl;
M.Khooryani SAYS

Hi because in last test your code print one additional "\n"

I recommend store output in StringBuilder and print it once! you can use Trim method to remove whitespace before and after the string

    Scanner in = new Scanner(System.in);
    StringBuilder sb=new StringBuilder();
    int t;
    while ((t = in.nextInt()) > 0) {
        { ... }
        sb.append("A has ").append(scoreA).append(" points. B has ").append(scoreB).append(" points.\n\n");
    }
    System.out.println(sb.toString().trim());