C# Program to Calculate the Sum of first 50 Natural 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 sum = 0;

               for (int Num = 1; Num <= 50; Num++)

               {

                   sum = sum + Num;

               }

               Console.WriteLine("Sum of first 50 Natural Numbers are :" +sum);               

            Console.ReadKey(); 

          }

    }

}


Output:-

Sum of first 50 Natural Numbers are :1275


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

0 टिप्पणियाँ