public FiboReturns getfibo(FiboElements input) { FiboReturns fibo = new FiboReturns(); int element = input.elements; if (element < 0 || element > 100) { element = 0; } for (int i = 1; i <= element; i++) { fibo.fibonnacci.Add(fibonaci(i)); } List <ulong> sort = fibo.fibonnacci; for (int i = sort.Count - 1; i >= 0; i--) { if (sort[i] % 2 == 0) { fibo.sorted.Add(sort[i]); } } for (int i = sort.Count - 1; i >= 0; i--) { if (sort[i] % 2 != 0) { fibo.sorted.Add(sort[i]); } } return(fibo); }
public FiboReturns getfibo(int id) { if (id < 0 || id > 100) { id = 0; } FiboReturns fibo = new FiboReturns(); for (int i = 1; i <= id; i++) { fibo.fibonnacci.Add(fibonaci(i)); } List <ulong> sort = fibo.fibonnacci; for (int i = sort.Count - 1; i >= 0; i--) { if (sort[i] % 2 == 0) { fibo.sorted.Add(sort[i]); } } for (int i = sort.Count - 1; i >= 0; i--) { if (sort[i] % 2 != 0) { fibo.sorted.Add(sort[i]); } } return(fibo); }