C# Program to Find the Sum of N Numbers

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Collections;

using System.Threading;

using System.IO;


namespace CSharpProgram

{

    class AkbTechie

     {

            static void Main(string[] args)

           {

             int num, sum = 0;

            Console.Write("Enter the Number : ");

            num = int.Parse(Console.ReadLine());

            for (int i = 0; i <= num; i++)

            {

                sum = sum + i;

            }

            Console.WriteLine("\nSum of N Numbers are : " + sum);                

            Console.ReadKey(); 

          }

    }

}


//Output:-

//Enter the Number : 7

//Sum of N Numbers are : 28


एक टिप्पणी भेजें

0 टिप्पणियाँ