Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Número primers
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static bool EsPrimer(long input){ if(input == 1 || input == 2){ return true;} if(input == 0){ return false;} for(long i = 2; i < input; i++){ if(input % i == 0){ return false; } } return true; } public static void Main(string[] args) { long n = 179424673; //canviar aixo Console.WriteLine("El numero {0} es primer? Anem a veure-ho", n); if(EsPrimer(n)){ Console.WriteLine("El numero {0} es primer",n); } else Console.WriteLine("No ho es"); } } }
run
|
edit
|
history
|
help
0
Armstrong
Extension Method Sample
"Live cooperation" problem fixed
HRGFCSFCA S
line 1 syntax error
file Info and File Stream
الحاسوب
Test date/time bug
LCM Q 3
Math 5.81