Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace di_lam_19_11_2019
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n,min,a;
- List<int> cong_ty = new List<int>();
- n = Convert.ToInt32(Console.ReadLine());
- for(int i =0; i<n; i++ )
- {
- a = Convert.ToInt32(Console.ReadLine());
- cong_ty.Add(a);
- }
- cong_ty.Sort();
- min = cong_ty[1] - cong_ty[0];
- for(int i = n-1 ; i>1; i--)
- {
- a = cong_ty[i] - cong_ty[i-1];
- if (a <= min) min = a;
- }
- Console.WriteLine("--------------->{0}",min);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement