class PatternDemo
{
public static void main(String s[])
{
int n = 5;
for(int i=1;i<=n;i++)
{
for(int j=0;j<i;j++)
{
System.out.print((i+j)%2+"\t");
}
System.out.print("\n");
}
}
}
Output:
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
class PatternDemo
{
public static void main(String s[])
{
int n = 4,k=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<=i;j++)
{
System.out.print((k++)+"\t");
}
System.out.print("\n");
}
}
}
Output:
0
1 2
3 4 5
6 7 8 9
Great Article
ReplyDeleteGreat Article android based projects
DeleteJava Training in Chennai Project Center in Chennai Java Training in Chennai projects for cse The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training
Thanks for IT the
ReplyDeletenic one Mr.Patel Patel ...keep updating codes with easy and efficient code...
ReplyDeleteThanks krushna akhade
DeleteNice program HARDCODER(Sir SOHAM PATEL)
ReplyDeleteThanks Prathamesh Agare
DeletemyTectra Placement Portal is a Web based portal brings Potentials Employers and myTectra Candidates on a common platform for placement assistance
ReplyDelete