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
Display The Even Numbers In Java
Alagunila Meganathan
Jul 25
2016
Code
511
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
import
java.io.*;
class
AllEvenNum{
public
static
void
main(String[] args) {
try
{
BufferedReader br1 =
new
BufferedReader(
new
InputStreamReader(System.in));
System.out.println(
"Enter number : "
);
int
num = Integer.parseInt(br1.readLine());
System.out.println(
"Even Numbers:"
);
for
(
int
i=
1
;i <=num ; i++){
if
(i%
2
==
0
){
System.out.print(i+
","
);
}
}
}
catch
(Exception e){}
}
}
Even numbers
Java