Updated to simpler example.

Now prints prime numbers from 1 to 100.
pull/1160/head
Arvind S 2018-10-31 23:15:03 +05:30 committed by GitHub
parent 074a0cc08b
commit 9c914da118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 11 deletions

View File

@ -1,23 +1,38 @@
/*
* C# Program to Display All the Prime Numbers Between 1 to 100
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VS
namespace PrimeNumber
{
class Program
{
static void Main(string[] args)
{
ProcessStartInfo si = new ProcessStartInfo();
float load= 3.2e02f;
si.FileName = @"tools\\node.exe";
si.Arguments = "tools\\simpleserver.js";
Process.Start(si);
{
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();
}
}
}