Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication7
- {
- class Program
- {
- static int evenSum(int a, int b)
- {
- int sum = 0;
- for (int i = a; i <= b; i++)
- {
- if (i % 2 == 0)
- {
- sum += i;
- }
- }
- return sum;
- }
- static void Main(string[] args)
- {
- int a, b;
- a = int.Parse( Console.ReadLine() );
- b = int.Parse(Console.ReadLine());
- Console.WriteLine(evenSum(a, b));
- }
- }
- }
Add Comment
Please, Sign In to add comment