Pattern mountain

Dang! You couldn’t score a perfect 100 because you failed one or more testcases. This means that your program didn’t account for all input cases (did you account for negative numbers, for example?).

i want solution for this error.

hello @vrcoolbuddy08
pls share ur code with me using cb ide.
i will correct it and share it back with u .

@vrcoolbuddy08
if u want refernce code then check this->

#include
#include
using namespace std;
int main()
{
int row=INT_MIN;
cin>>row;
for(int i=1;i<=row;i++)
{
int k=1;
for(int j=1;j<=7;j++)
{
if(j<=i||j>=8-i)
{
cout<<k<<" “;
j<4?k++:k–;
}
else
{
cout<<” “;
if(j==4)
k–;
}
}
cout<<”\n";
}
return 0;
}

this is my code and for negative number ill take row=int_min

u need to generalise ur code (ie it should work for all cases).
right now u have hardcoded the value becuase of which it is giving u wrong answer.
check my shared code for reference

ohhkk
whats the error in my code

@vrcoolbuddy08

image

these values will be different for different input right?
but u r always using these fixed value which will give u wrong result for different input

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.