CSharp: Sucessores ordenados

From AdonaiMedrado.Pro.Br
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);
		}
	}
}