Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Prime Fibonacci
//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) { int[] a = new int[10000000]; int n = Convert.ToInt32(Console.ReadLine()); int[] b = new int[n + 1]; int p = 2, count, sum1, i, j, l, k = 0; a[0] = a[1] = 1; for (i = 2; i < n; i++) { a[i] = a[i - 1] + a[i - 2]; count = 0; if (a[i] != 2) { for (j = 2; j < Math.Sqrt(a[i]); j++) { if (a[i] % j == 0) { count++; break; } } } if (count == 0) { b[k] = a[i]; for (l = 0; l <= k; l++) Console.Write(b[l] + " "); Console.WriteLine(); k++; } }Console.ReadKey(); } } }
run
|
edit
|
history
|
help
0
DateTime
Count occurences of Character
Xml in C#
Ejemplos polimorfismos con interfaces y posibles usos sencillos c#
Ejercicio 1 clase 8 feb
extrefGenerate
testing DT Serialization
Find smallest and largest integers in unsorted array
Fórum ➡ My Category Attribute ↔ New Default Attribute: Behavior ♦
Interlocked Class (atomic operations)