Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace SumOfOddNumbers
- {
- class Program
- {
- static void Main()
- {
- int num = int.Parse(Console.ReadLine());
- int sum = 0;
- for (int i = 1; i < num * 2; i+=2)
- {
- Console.WriteLine(i);
- sum += i;
- }
- Console.WriteLine($"Sum: {sum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement