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 |
CSS corp interview process and placement papers
What is success factors online trainings?
how to write regression test case?what is the difference between Client server & web based Testing? can we able to do UI Testing in web based Testing
WHAT IS DIFFERENCE BETWEEN ART & VECTOR QUANTISATION BASED ON THEIR APPLICATION IN NEURAL NETWORK
what is rapid application development
why we need embedded system
PREVIOUS AND NEW companies positive and negative points AFTER LIVING
which of the following is not a storage class specifier in c?
PLEASE SUGGEST THE BALLY PLACEMENT PAPER PATTERN ABOUT WRITTEN TEST,INTERVIEW,HR.ITS URGENT. AS BALLY IS GOING TO VISIT OUR CAMPUS.
write a c++ program to interchange two-integer number without using the third variable. use concept of constructor overloading.
The old welding machine use electro- -magnetic winding to step up the current for welding rods,what is new principle inside the welding
where is the first engeenering college of Asia
Civil Engineering (5086)
Mechanical Engineering (4456)
Electrical Engineering (16639)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)