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
Find the Prime Number between 1 to 100 in C#
Vijay Kumar
Oct 10
2015
Code
43.9
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
PrimeNumber.rar
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
namespace
PrimeNumber {
class
Program {
static
void
Main(
string
[] args) {
bool
IsPrime =
true
;
Console.WriteLine(
"Prime numbers :"
);
for
(
int
i = 2; i <= 100; i++) {
for
(
int
j = 2; j < 100; j++) {
if
(i != j && i % j == 0) {
IsPrime =
false
;
break
;
}
}
if
(IsPrime) {
Console.Write(
"\t"
+ i);
}
IsPrime =
true
;
}
Console.ReadKey();
}
}
}
C#
Prime Number
Find the Prime Number