VPanev

Untitled

Nov 30th, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace ConsoleApp1
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int n = int.Parse(Console.ReadLine());
  12. int k = int.Parse(Console.ReadLine());
  13.  
  14. int[] numbers = new int[n];
  15.  
  16. for (int i = 0; i < numbers.Length; i++)
  17. {
  18. numbers[i] = int.Parse(Console.ReadLine());
  19. }
  20.  
  21. int sum = 0;
  22.  
  23. for (int i = 0; i < numbers.Length; i++)
  24. {
  25. if (numbers[i] > k)
  26. {
  27. sum += numbers[i];
  28. }
  29. }
  30. Console.WriteLine(sum);
  31. }
  32. }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment