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;
- using System.Threading.Tasks;
- namespace Praktika6
- {
- class Program
- {
- static void Main(string[] args)
- {
- Solution_08();
- Console.ReadKey();
- }
- static void Solution_08()
- {
- Console.WriteLine("Solution_08: Integer increment from A to B");
- Console.WriteLine("Enter number A");
- int a = int.Parse(Console.ReadLine());
- Console.WriteLine("Enter number B");
- int b = int.Parse(Console.ReadLine());
- Console.WriteLine("Sum from A to B = " + (Solution_08(a, b)));
- Console.WriteLine();
- }
- private static int Solution_08(int a, int b)
- {
- int sum = 0;
- for (int i = a; i <= b; i++)
- {
- sum += i;
- }
- return sum;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement