Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

code to print 1 1 1 1 in 1st row,1 0 0 1 in 2nd row, 1 0 0 1 in 3rd row, 1 1 1 1 in 4th row

0 votes
asked Jul 6, 2019 by Varun Mahesh Reddy

7 Answers

0 votes
answered Jul 8, 2019 by saksham (140 points)
print("1111/

1001/

1111")
0 votes
answered Jul 10, 2019 by brahma reddy
#include<stdio.h>

int main()

{

  int i, j;

for(i=1; i<=4; i=i++)

{

 for(j=1; j<=4; j=j++)

{

   if(j=4 || j=1|| i=1 || i=4)

printf("1");

else

printf("0")

}

printf("\n");

}

return o;

}
0 votes
answered Jul 10, 2019 by vijay (150 points)
edited Jul 11, 2019 by vijay
#include<stdio.h>

int main()

{

  int i, j,r,c;

scanf("%d",&r);

scanf("%d",&c);

for(i=1; i<=r; i++)

{

 for(j=1; j<=c; j++)

{

   if(j==1||j==r||i==1||i==c)
   {

printf("1");
}
else

printf("0");

}

printf("\n");

}
}
0 votes
answered Jul 10, 2019 by anonymous
for i in range(1,4):
    for j in range(1,4):
        if i==1 or i==4 or j==1 or j==i:
            print ('1');
        else:
            print('0')
0 votes
answered Jul 12, 2019 by Abhinav
public class Main

{

public static void main(String[] args) {

int i,j;

for (i=0;i<4;i++)

{   

    for(j=0;j<4;j++)

    {

        if( j==0 | j==3 | i==0 | i== 3)

        {

            System.out.print("1 ");

        }

        else

        {

            System.out.print("0 ");

        }

    }

         System.out.println("");

}

}

}
0 votes
answered Jul 12, 2019 by Parvez khan (140 points)
#include <stdio.h>

int main()

{

int i,j;

i=1;

for(i==1,j<=1,j++);

printf("%d",i);

return 0:

}
0 votes
answered Jul 13, 2019 by Rajiv Pandit (140 points)
#include<stdio.h>

void main()

{

printf("\n 1 1 1 1 \n 1 0 0 1 \n 1 0 0 1 \n 1 1 1 1");

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...