Advertisement
NadyaMisheva

imena Ivan

Feb 3rd, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. using System;
  2.  
  3. public class Program
  4. {
  5. public static void Main()
  6. {
  7. int n = int.Parse(Console.ReadLine());
  8. string [] name = new string[n];
  9. for(int i = 0; i < name.Length ; i++)
  10. {
  11. name[i] = (Console.ReadLine());
  12. }
  13. Array.Sort(name);
  14. Array.Reverse(name);
  15. int countI = 0;
  16. int counti = 0;
  17. for(int i = 0; i< name.Length ; i++)
  18. {
  19. Console.WriteLine(" {0}.{1}", i + 1, name[i]);
  20. if(name[i] == "ivan")
  21. {
  22. countI++;
  23. }
  24.  
  25. if (name[i][0] == 'i')
  26. {
  27. counti++;
  28. }
  29. }
  30. Console.WriteLine("Имената \"Иван\" са {0}", countI);
  31. Console.WriteLine("Имената с И са {0}", counti);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement