Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Prime Number
//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; using System.Reflection; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Int32 inu = 1; try { if(IsPrimeNo(inu)) Console.WriteLine("Number "+inu.ToString()+" is not Prime."); else Console.WriteLine("Number "+inu.ToString()+" is Prime."); } catch(Exception ex) { Console.WriteLine("Error occured while running job. Error is" + ex.Message ); } } static bool IsPrimeNo(int iNu ) { try { int IDm = 0; IDm = iNu/2; bool iBl = false; for(int i=2; i <= IDm; i++) { if(iNu % i > 0) { iBl = false; } else { iBl = true; break; } } return iBl; } catch(Exception ex) { throw; } } } }
run
|
edit
|
history
|
help
0
CheckingAccount
Hex character codes
Unturned_Plugins
Prac1_A
Naju Date Format Issue
Create URL Safe and Cryptographically Strong Short GUID
Found many section of times intersect (can edit)
Intuit // C# // listing_4.3 (StreamWriter // output.txt)
return multiple value from function
a