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
How To Find Prime Numbers From 1 To 100 Using C#
Vijayaragavan S
Aug 25
2016
Code
49.4
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
class
Program {
static
void
Main() {
//Declaration
bool
isPrime =
true
;
int
i, j;
//Calculate and display the Prime number
Console.WriteLine(
"Prime Numbers are : "
);
for
(i = 2; i <= 100; i++) {
for
(j = 2; j <= 100; j++) {
if
(i != j && i % j == 0) {
isPrime =
false
;
break
;
}
}
if
(isPrime) {
Console.Write(
"\t"
+ i);
}
isPrime =
true
;
}
Console.ReadKey();
}
}
Find Prime Numbers
C#