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; namespace Rextester { public class Program { public static void Main(string[] args) { Console.Write("Enter a Number : "); int num; num = Convert.ToInt32(Console.ReadLine()); int k; k = 0; for (int i = 1; i <= num/2; i++) { if (num % i == 0) { k++; } } if (k == 2) { Console.WriteLine("Entered Number is a Prime Number and the Largest Factor is {0}",num); } else { Console.WriteLine("Not a Prime Number"); } Console.ReadLine(); } } }
run
|
edit
|
history
|
help
1
Riemann Sums
b
Types
Клас cstatic
C# Events and Delegates example
Number Comparer
MultiThreading and CancellationToken
StudentUserInput
SpiltStringBetweenSpecialCharacters
two words are anagrams