can anybody please provide me the code and explain me the code
Pattern with zeros
Hi @bakshianjali49,
#include<iostream>
using namespace std;
int main() {
int n,i,j;
cin>>n;
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
if (j==1 || j==i){
cout<<i<<" ";
}
else{
cout<<0<<" ";
}
}
cout<<endl;
}
return 0;
}
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.