It's not able to satisfy the test cases

Logic is correct but you have to produce output according to Question

Mistakes:

  1. at line-08 : correct statement is:

    { for(s=1;s<=(n-i);s++)
    Because you have to produce one extra space at the starting of each line

  2. at line-10: correct statement is:
    cout<<" "; // two spaces

  3. at line-24: correct statement is:
    cout<<x<<" "; //three spaces

Your Modified code is:

i hope this help, if you have further doubt, feel free to ask

1 Like