Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
General.cs
//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 Solution { public int number; public int ReturnFactorial(int n) { if(n == 1) return n; return n * ReturnFactorial(n -1); } public bool IsPrime(int number) { if(number == 1) return false; return IsPrime(number,number -1 ); } private bool IsPrime(int number,int divider) { if(divider == 1) return true; return ((number % divider != 0) && IsPrime(number,divider - 1)); } } public class Program { public static void Main(string[] args) { Solution sl = new Solution(); //Your code goes here Console.WriteLine("Hello, world!"+sl.ReturnFactorial(4)+" : "); for(int i = 1; i< 100; i++) { if(sl.IsPrime(i)) Console.Write(i+", "); } } } }
run
|
edit
|
history
|
help
0
test
abebe
Demo
QuickSort
Guid Combined
Day1
Median in two sorted lists (O(m*n))
Lab7
CubexSoft
Kz