Advertisement
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;
- namespace ConsoleApplication5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int a;
- do{
- Console.WriteLine("\nKérem az első egész számot:");
- a = int.Parse(Console.ReadLine());
- } while(a <= 0);
- int b;
- do
- {
- Console.WriteLine("\nKérem a második egész számot:");
- b = int.Parse(Console.ReadLine());
- } while (b <= 0);
- Console.WriteLine("\nKözöttük lévő páros számok összege");
- if (b < a)
- {
- int csere = a;
- a = b;
- b = csere;
- }
- int sum = 0;
- for (a++; a != b; a++)
- {
- if (a % 2 == 0)
- {
- sum += a;
- }
- }
- Console.WriteLine(sum);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement