//Write a Simple C# program that computationally prints out all prime numbers from 2 to 500.
//A prime number is, roughly, a number greater than 1 that is divisible only by 1 or itself.
//Please create a static method called "isPrime" that reterns whether an integer x is a prime number:
//static bool isPrime(int x){
using System;
public class Program
{
static bool isPrime(int x) {
int i;
for (i = 2; i < x; i++){
if(x % i == 0){
return false;
}
return true;
public static void Main()
int x;
for(x = 2; x < 500; x++){
if(isPrime(x)){
Console.WriteLine(x);