c# form.cs 代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int i,j,t=0;
StreamWriter sw;
sw = File.CreateText("E:\\dataout.txt");
for (i = 3; i < 100; i++)
{
t = 0;
for (j = 2; j <= Math.Sqrt(i); j++)
{
if (i % j == 0)
{
t = 1;
break;
}
}
if (t == 0)
{
sw.WriteLine(i.ToString());
}
}
sw.Close();
}
private void button1_Click(object sender, EventArgs e)
{
StreamReader sr = new StreamReader("E:\\dataout.txt");
string str;
try
{
str = sr.ReadLine();
while (str !=null)
{
textBox1.Text = textBox1.Text + "\t"+str;
str = sr.ReadLine();
}
}
catch
{ }
sr.Close();
}
}
}
class Prime+888{public static void main(String args[]){int i;int j;for(j=3;j<=100;j++){for(i=3;i<=j/2;i++){if(j%i==0)break;}if(i>j/2){System.out.println(""+j+"是素数");}}}}
什么语言