Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
My Wall
//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 void Main (string[] args) { Console.WriteLine ("See if number is prime."); string readNumber = Console.ReadLine(); int useNumber = Int32.Parse(readNumber); string result = Calculate(useNumber); Console.WriteLine(result); } public static string Calculate(int number){ string isPrime = "Is Prime"; string notPrime = "Not Prime"; int checkNumber = (2^number-2)%number; if (checkNumber == 0) return isPrime; else return notPrime; } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Project Euler Problem 7
divisão
Assignment
EVEN AND ODD
EX8 For_Loop & While_loop
Lambda Expression
Only unique chars into string?
10857
Retirar valores das tags de um XML padrão TISS/ANS SIB
Palindrome String
Please log in to post a comment.