programming-examples/c-sharp/Mathematics/C# Program to Find the Sum of first 50 Natural Numbers using For Loop.cs
2019-11-15 12:59:38 +01:00

21 lines
391 B
C#

/*
* C# Program to Find the Sum of first 50 Natural Numbers
* using For Loop
*/
using System;
class program
{
public static void Main()
{
int num, sum = 0;
for (num = 1; num <= 50; num++)
{
sum = sum + num;
}
Console.WriteLine("Sum = {0}", sum);
Console.ReadLine();
}
}
/*
Sum = 1275