fahimkamal63

Summation in C# -1

Oct 18th, 2021
584
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class Summation
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("Enter the value of n: ");
  8.         int n = Convert.ToInt32(Console.ReadLine());
  9.  
  10.         int sum = 0;
  11.         for (int i = 1; i <= n; i++)
  12.         {
  13.             sum += i;
  14.         }      
  15.  
  16.         Console.WriteLine("The Summation of n is: {0}", sum);
  17.     }
  18. }
RAW Paste Data