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 ConsoleApplication12
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n, total = 0;
- Console.Write("N = ");
- n = int.Parse(Console.ReadLine());
- for (int i = n; i > 0; i--)
- {
- total = total + n;
- n--;
- }
- Console.Write("Sum is: " + total);
- }
- }
- }
Add Comment
Please, Sign In to add comment