CSharp: Sucessores ordenados

From AdonaiMedrado.Pro.Br
Revision as of 17:57, 26 May 2009 by Adonaimedrado (Talk | contribs) (New page: <code lang="csharp"> using System; using System.Linq; using System.Collections.Generic; namespace SucessoresOrdenados { class Program { public static void Main(string[] args) { i...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
using System;
using System.Linq;
using System.Collections.Generic;
 
namespace SucessoresOrdenados
{
	class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			System.Collections.Generic.List<int> l = 
				new System.Collections.Generic.List<int>();
			for(int i = 0;i < n; i++)
				l.Add(int.Parse(Console.ReadLine()));
 
			IEnumerable<int> res = from k in l				      
					  orderby k
				      select k+1;
 
			foreach(int k in res)
				Console.WriteLine(k);
		}
	}
}