Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PrintAndSum
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num1 = int.Parse(Console.ReadLine());
- int num2 = int.Parse(Console.ReadLine());
- int sum = 0;
- for (int i = num1; i <= num2; i++)
- {
- Console.Write($"{i} ");
- sum += i;
- }
- Console.WriteLine($"\nSum: {sum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement