C# Corner
Tech
News
Videos
Forums
Trainings
Books
Events
More
Interviews
Jobs
Live
Learn
Career
Members
Blogs
Challenges
Certifications
Bounties
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Calculate Floyd Triangle Program In Diffrent Way Using Java
WhatsApp
Senthilvelan Sambamoorthy
Aug 13
2016
656
0
0
ssva10.rar
/* FLOYD'S TRIANGLE */
import
java.io.*;
class
ssva10
{
public
static
void
main(String arg[])
throws
IOException
{
BufferedReader b=
new
BufferedReader(
new
InputStreamReader(System.in));
System.out.print(
"\n FLOYD'S TRIANGLE\n"
);
System.out.print(
"\n ENTER THE NUMBER OF SIZE : "
);
int
n=Integer.parseInt(b.readLine());
for
(
int
i=
1
;i<n;i++)
{
for
(
int
j=
1
;j<i;j++)
{
if
(i%
2
==
0
)
{
if
(j%
2
==
0
)
{
System.out.print(
"0 "
);
}
else
{
System.out.print(
"1 "
);
}
}
else
{
if
(j%
2
==
1
)
System.out.print(
"0 "
);
else
System.out.print(
"1 "
);
}
}
System.out.println(
"\n"
);
}
}
}
Java
Calculate Floyd Triangle
Up Next
Calculate Floyd Triangle Program In Diffrent Way Using Java