Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Find the missing number in an array2
//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 [] arr = new int []{1,3,4,5,6,7,8,9}; int num = findMissingnum(arr); Console.Write(num); } public static int findMissingnum(int[] a) { int i=0; for(int j=1; j<a.Length; j++) { //Console.WriteLine(a[j] - a[i]); if((a[j] - a[i]) > 1) { return a[i]+1; } i++; } return 0; } } }
run
|
edit
|
history
|
help
0
orytitoyt
remove special char c#
FindElementInAscendingSortedRotatedArray
linq jean by Fausto
Simple Enum Parsing
Game v1.0.1
Bubble Sort
Task 1_4
Intuit // C# // listing_4.1 (Console.WriteLine _ Форматный вывод)
EVEN AND ODD