Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
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
632
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