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
GP-TIME
Date Conversion
rekenmachine in c#
Vajdalinky
Valida Fechas futuras
Intuit // C# // Lecture_4 // Laba_#2
sdfgtfgb
Store reference to a object
12
LINQ