1
01
101
0101
10101
Answers were Sorted based on User's Feedback
Answer / best in the world
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d ",(i+j+1)%2);
}
printf("\n");
}
getch();
}
THIS IS THE BEST SOLUTION IN THE WORLD
Is This Answer Correct ? | 59 Yes | 11 No |
Answer / suket
Mine doesn't require 3 variables:
#include<stdio.h>
int main()
{
int i,j,rows;
printf("Enter no. of rows: ");
scanf("%d",&rows);
printf("Here's your pattern: \n");
for (i=1;i<=rows;i++)
{
for(j=i;j!=0;)
{
if(j%2==0)
{
printf("01");
j=j-2;
}
else
{
printf("1");
j--;
}
}
printf("\n");
}
return 0;
}
Is This Answer Correct ? | 7 Yes | 4 No |
Answer / guriya kumari
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
if(i%2==0)
{
if(j%2==0)
{
k=1;
printf("%d",k);
}
else
{
k=0;
printf("%d",k);
}
}
else
{
if(j%2==0)
{
k=0;
printf("%d",k);
}
else
{
k=1;
printf("%d",k);
}
}
}
printf("\n");
}
}
Is This Answer Correct ? | 7 Yes | 6 No |
Answer / krishna anil dadge
#include<iostream>
using namespace std;
int main()
{
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
if((i+j)%2==0)
{
cout<<"1";
}
else
{
cout<<"0";
}
}
cout<<endl;
}
return 0;
}
Is This Answer Correct ? | 1 Yes | 0 No |
What is the basic difference between injection speed and injection pressure in an injection molding machine?
find the salary of an employee where employee number is known
what is the difference between C and C++? what is the difference between scanf and gets? what is mean by extern what is the use of it? what will happen if i say delete this> Difference between C structure and C++ structure? What is the difference between overloading and overridding? Explain the need for "virtual Destructor" Can we have "virtual Constructors"? What is the different types of polymorphism> What is virtual functions? How to implement virtual function in "C"? What are the different types of storage classes?
i need the placement paper of ford IT service...
is there increase in the pressure of water or the density of water if we go deep into the ocean.(but the density of water is 1000kg/cubic meter)?
How do you remove meta only for the root slice? remaining slices should run under meta?
Box 1 cotain odd value X or Y the box 2 =X i.e 7 or 12 box 3= Y has value 19 if X is 7 or 31 if x is 12 get even value X or Y Use any operator steps allowed 3.
What are the methods available in storing sequential files ?
what is the differences between software engineering and other engineering disciplines.
Q1. What do you mean by VPN(virtual private network)? Q2. What do you mean by switching and what are it's type? @3. What do you mean by ATM switching?
What is diff b/w TON and BTU for Air conditioner?
When are the SBI clerk 2010 results are expected???