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 _4.Print_and_Sum
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- int NumStart = int.Parse(Console.ReadLine());
- int NumEnd = int.Parse(Console.ReadLine());
- int Sum = 0;
- for (int i = NumStart; i <= NumEnd; i++)
- {
- Console.Write(i + " ");
- Sum += i;
- if (i== NumEnd)
- {
- Console.WriteLine();
- }
- }
- Console.WriteLine($"Sum: {Sum}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment