C# - How To Find Primitive And Pairs Numbers From Int Array In C#
__________________________________________________________________________
In This C# Code We Will See How To Find The Primitive Numbers Or The Pairs Numbers From An Int Array In C# Programming Language.
Source Code:
In This C# Code We Will See How To Find The Primitive Numbers Or The Pairs Numbers From An Int Array In C# Programming Language.
Source Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int[] ns = {2,54,3,24,5,23,76,13,10,19,88,41}; //get pairs numbers Console.WriteLine("List Of Pairs Numbers");
for (int i = 0; i < ns.Count(); i++) { if(ns[i]%2 == 0) Console.WriteLine(ns[i]); } Console.WriteLine("________"); //get Primitive numbers Console.WriteLine("List Of Primitive Numbers");
for(int i = 0; i < ns.Count(); i++){
if(ns[i]%2 != 0) Console.WriteLine(ns[i]);
}
Console.ReadLine();
}
}
}
//////////OUTPUT:
Primitive Pairs Numbers In C# |