Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- namespace whatevs
- {
- class Program
- {
- static void Main(string[] args)
- {
- int start = int.Parse(Console.ReadLine());
- int end = int.Parse(Console.ReadLine());
- int n = end - start + 1;
- int[] arr = new int[n];
- for (int i = 0; i < n ; i++)
- {
- arr[i] = i + start;
- }
- int sum = arr.Sum();
- string[] numbers = arr.Select(x => x.ToString()).ToArray();
- string answer = string.Join(" ", numbers.ToArray());
- Console.WriteLine(answer);
- Console.WriteLine($"Sum: {sum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement