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
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Quang Dinh Luong
NA
76
18.8k
Errors in Apps Checking Prime Number
Oct 6 2015 11:06 PM
This is how my program looks like, sorry for bad arrangement
I get this error: Cannot implicity convert type "string" to "int"
Anyone knows how to fix it? Your help'll be very appriciated
namespace IsThisPrime
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int x = textBox1.Text;
int i = 0;
bool Flag = false;
for (i = 2; i <= x / 2; i++)
{
if ((i == x))
i = i + 1;
if ((x % i == 0))
{
Flag = true;
break;
}
}
if ((Flag == false))
{
// this num is prime number
MessageBox.Show("PRIME");
}
else
{
// this num is not prime number
MessageBox.Show("NOT PRIME");
}
Reply
Answers (
12
)
ASP DOT Net
how to get value in selected tagin cookie