Patternmountain

Here the right half is getting wrong inputs…but i am not able to correct it …will you please tell what should i update in my code
#include
using namespace std;
int main() {
int n;
cin>>n;
int r,c,i;
for(r=1 ; r<=n ; r++){
i = 1;
for(c = 1 ; c<=2n-1 ; c++){
if(c<=r || c >= 2
n -r){
cout<<i<<’\t’;
if(c<n){
i++;
}
else{
i–;
}
}
else{
cout<<" "<<’\t’;
}
}
cout<<endl;
}
return 0;
}

@abhinavssr2003_eab0717682969e5c,
check this ive corrected you code and commented https://ide.codingblocks.com/s/655972

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.