TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Calculate Floyd Triangle Program In Diffrent Way Using Java
Senthilvelan Sambamoorthy
Aug 13
2016
Code
587
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
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