Advertisement
Qrist

Untitled

Apr 17th, 2020
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Program
  5. {
  6.     public static void Main(string[] args)
  7.     {
  8.         int[] nums = Console.ReadLine().Split().Select(int.Parse).ToArray();
  9.         int sum = 0;
  10.         for (int i = 0; i < nums.Length; i++)
  11.         {
  12.             int currentNumber = nums[i];
  13.             {
  14.                 if(currentNumber%2==0)
  15.                 {
  16.                     sum += currentNumber;
  17.                 }
  18.             }
  19.         }
  20.         Console.WriteLine("Sum = " + sum);
  21.  
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement