Https://hack.codingblocks.com/contests/c/255/47

#include
using namespace std;

int main() {
int n,i,j,k=0;
cin>>n;
for(i=0;i<n;i++)
{
for (j=0;j<=i;j++)
{
while (n%i==0 && k<n){
if (n%(2*i+1)==0 ||(i<n && j==0)||i==j)
cout<<“1”;
else
cout<<“0”;
k++;
}

  if ((n%i)!=0)
  cout<<"1";

}
cout<<endl;
}
}
this code is not working

you are doing modulus with zero…something % 0 is not def. check this either start loop with 1

Heyy @Rahul-Bachloo-912363
Actually its not only about modulus with zero , your code is not working for N=6 even if i made extra case for i=0 . So it seems some logical error .
I modified ur code here ,check it out
https://ide.codingblocks.com/#/s/16476

then output is not as desired
output:
111111

1111
11111

check this
https://ide.codingblocks.com/#/s/16478