1
01
101
0101
10101

Answers were Sorted based on User's Feedback



1 01 101 0101 10101..

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

1 01 101 0101 10101..

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

1 01 101 0101 10101..

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

1 01 101 0101 10101..

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

Post New Answer

More Engineering AllOther Interview Questions

What is the basic difference between injection speed and injection pressure in an injection molding machine?

0 Answers  


find the salary of an employee where employee number is known

0 Answers  


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?

0 Answers  


i need the placement paper of ford IT service...

0 Answers  


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)?

1 Answers  






How do you remove meta only for the root slice? remaining slices should run under meta?

0 Answers  


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.

0 Answers  


What are the methods available in storing sequential files ?

2 Answers  


what is the differences between software engineering and other engineering disciplines.

0 Answers  


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?

3 Answers  


What is diff b/w TON and BTU for Air conditioner?

0 Answers  


When are the SBI clerk 2010 results are expected???

1 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5085)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4451)
  • Electrical Engineering Interview Questions Electrical Engineering (16632)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)