I have written the code of this program and i have checked the logic of the program is absolutely correct but there is an syntax error is coming and i am not able to resolve it please check my code and help to resolve it
#include
using namespace std;
int main() {
int i,j,k,l,n,m;
cin>>n;
m=n*2-1;
for(i=1;i<=n-1;i++){
for(j=1;j<=i;j++){
cout<<j;
}
for(k=1;k<=m-2i;k++){
cout<<" ";
}
for(l=i;l>0;l–){
cout<<l;
}
cout<<endl;
}
for(i=1;i<=n;i++)
{
cout<<i;
}
for(i=n-1;i>0;i–){
cout<<i;
}
return 0;
}
Pattern mountain
I have saved my code to coding blocks ide with name mountain.cpp please see to it
bro u will have to share that link with me… i cant access it like this
u can refer my code https://ide.codingblocks.com/s/607076
see if you can access it now otherwise this is my whatsapp number 8376881276 and my mail [email protected] you can message me here
whatever is there share here only… and pls don’t share any personal details
ok… I have corrected ur code https://ide.codingblocks.com/s/607139
there were 2 mistakes…
here u had written 2i while it should be 2*i (multiply sign was missing)
and secondly in o/p a tab is expected while printing… so that was to be added…
rest ur logic was fine…
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.